Question

So I have a large string with several similar things. I want to find part of a string but have part of it be irrelevant.

For example: "0" blah"11" "0" blah"3" "0" blah"6" "0" blah"600" "0"

I want to find ' blah"..." ' Where '...' is the number and I can get the value of '...'

Is there an easy way to do that?

Was it helpful?

Solution

>>> import re
>>> re.findall(r'blah"(\d+)"','"0" blah"11" "0" blah"3" "0" blah"6" "0" blah"600" "0"')
['11', '3', '6', '600']
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top