[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to use regex to search string between {}?

> If I have path: /home/admin/hello/yo/{h1,h2,h3,h4}
> import re
> r = re.search('{.}', path)
> # r should be ['h1,h2,h3,h4'] but I fail
> Why always search nothing?

A site like http://www.pyregex.com/ allows you to check your regex with
slightly fewer clicks and keystrokes than editing your program.