I’m trying to extract all the words that matches a pattern from a string, but with Formatter I only have the first match.
Here is my string (don’t mind ‘3 dirigeants’, I used another regex for that one)
Vendredi : 2, Jeudi : 1, Mercredi : 3, Mardi : 1
I used 2 regular expressions as I want to have the numbers in a row and the 4 last words in another row.
This is the first regex for the numbers (2, 1, 3, 1) :
(?<= : )\d+
And this is the one for the words (Vendredi, Jeudi, Mercredi, Mardi :
But as I said, it only returns the first match for both. So I tried to code instead but I don’t know much about Python… this is what I have so far but I guess it is all wrong as it doesn’t work.
By any chance, can someone know how I can solve my problem ?
Thank you very much for your help.
Best answer by andywingraveView original
Hey. I think you need to chop the elephant up a little more here before you can apply the REGEX.
The core of this is, I’ve split the strings up into two arrays - Returned only letters in one, and only numbers in the other
Hope that helps!