Answer by Tom Lord for python regex find text with digits
The reason that you are getting results like [('one', '1290')] rather than one=1290 is because you are using capture groups. Use:r"(?:one|two)=(?:\d{4,5})(?=\D)"I have removed the additional +...
View ArticleAnswer by Thomas Ayoub for python regex find text with digits
Make the inner groups non capturing: ((?:one|two)+=+(?:\d{4,5})+\D)
View ArticleAnswer by DeepSpace for python regex find text with digits
You were close. You need to use a single capture group (or none for that matter):((?:one|two)+=+\d{4,5})+Full code:import restring =...
View Articlepython regex find text with digits
I have text like: sometext...one=1290...sometext...two=12985...sometext...three=1233...How can I find one=1290 and two=12985 but not three or four or five? There are can be from 4 to 5 digits after =....
View Article
More Pages to Explore .....