user2430629
user2430629

Reputation:

Python: Find Surrounding parts of a string with irrelevant section in the middle

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?

Upvotes: 0

Views: 83

Answers (1)

Jiaming Lu
Jiaming Lu

Reputation: 885

>>> import re
>>> re.findall(r'blah"(\d+)"','"0" blah"11" "0" blah"3" "0" blah"6" "0" blah"600" "0"')
['11', '3', '6', '600']

Upvotes: 1

Related Questions