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

Answer by John for Python extract pattern matches

$
0
0

Maybe that's a bit shorter and easier to understand:

>>> import re>>> text = '... someline abc... someother line... name my_user_name is valid.. some more lines'>>> re.search('name (.*) is valid', text).group(1)'my_user_name'

Viewing all articles
Browse latest Browse all 12

Trending Articles



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