I'm trying to write a python regex matching two patterns:
the first one is scratch_alpha
and the second one is scratch_alpha1*12 (where 12 can be any decimal number)
and I'd like to put the value after * inside a variable and if scratch_alpha is detected with * after, just write 1 in a variable
I wrote this regex:
([a-zA-Z0-9\_*]+)(\*\d+)?
I expected to get two groups after, the first one which would be the name "scratch_alpha" and the second which would be the number after * or None (and if None, I initialize the variable to 1).
But with my regex, it seems that the first group contains everything (scratch_alpha*12) and not scratch_alpha in first group and value in second group.
*from[a-zA-Z...]