Hi,
I'm trying to write a regex that finds whatever is between ${ and } in a text
file.
I tried the following, but it only finds the first occurrence of the pattern:
[color=blue][color=green][color=darkred]
>>> s = """asssdf${ 123}[/color][/color][/color]
dgww${one} ${two}"""[color=blue][color=green][color=darkred]
>>> what = re.compile("\$\ {([^}]*)\}")
>>> m = what.search(s)
>>> m.groups()[/color][/color][/color]
('123',)
What am I doing wrong? O:-)
I'm trying to write a regex that finds whatever is between ${ and } in a text
file.
I tried the following, but it only finds the first occurrence of the pattern:
[color=blue][color=green][color=darkred]
>>> s = """asssdf${ 123}[/color][/color][/color]
dgww${one} ${two}"""[color=blue][color=green][color=darkred]
>>> what = re.compile("\$\ {([^}]*)\}")
>>> m = what.search(s)
>>> m.groups()[/color][/color][/color]
('123',)
What am I doing wrong? O:-)
Comment