Quantcast
Channel: Python extract pattern matches - Stack Overflow
Viewing all articles
Browse latest Browse all 12

Answer by Henry Keiter for Python extract pattern matches

$
0
0

You want a capture group.

p = re.compile("name (.*) is valid", re.flags) # parentheses for capture groupsprint p.match(s).groups() # This gives you a tuple of your matches.

Viewing all articles
Browse latest Browse all 12

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>