Struggling with Python Regex for a very specific array -


i'm trying make regex method (if can find easier method, please tell)

for example: need lines marked "!" @ end

[expertsingle] { 192 = n 0 0 384 = n 0 0 576 = n 0 0 768 = n 0 0 960 = n 0 0 } 

edit: replaced actual data

you find lines 1 or more numbers

import re inputstr = """[expertsingle] { 192 = n 0 0 270 = n 1 0 270 = n 2 0 360 = n 0 0 }"""  goodlines = re.findall(r"\d+.+", inputstr) print(goodlines) 

this outputs: ['192 = n 0 0', '270 = n 1 0', '270 = n 2 0', '360 = n 0 0']

if wanted ultra strict , find words in format of digits, space, equals, space, letter, space, digit, space, digit use

goodlines = re.findall(r"\d+\s=\s\w\s\d\s\d", inputstr) 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo