#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2016
    Posts
    1
    Rep Power
    0

    Newbie Need Help On Regex!


    Hey guys!

    I am new to learning regex in python and I'm wondering how do I use regex in python to store the integers(positive and negative) i want into a list!

    For e.g.

    This is the data in a list.

    [u'\x1b[0m[\x1b[1m\x1b[0m\xbb\x1b[0m\x1b[36m]\x1b[0m (A=-5,B=5)', u'\x1b[0m[\x1b[1m\x1b[0m\xbb\x1b[0m\x1b[36m]\x1b[0m (A=5,Y=5)', u'\x1b[0m[\x1b[1m\x1b[10m\xbb\x1b[0m\x1b[36m]\x1b[0m : ']

    How do I extract the values of A and B and store them in a variable I want using regex?

    Thank you and appreciate it
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2016
    Posts
    21
    Rep Power
    0
    try

    ([ABY]=([-]?\d+))

    you can test it on https://regex101.com/

IMN logo majestic logo threadwatch logo seochat tools logo