My pattern:
Which produces:
Which is pretty much what I want. I just want the values, delimited by a pipe. When I tried to use '|' as a delimiter it would pick up everything except the last item, probably because there was no terminating delimiter. Since I couldnt use a delimiter this feels ghetto. Is there a better way to do this? Ideally I'd strip off that ' px' as well, but doing that created match objects with one or more null elements.
Code:
import re
string = "Encoded: 1920 x 1080 px | Display: 1920 x 1080 px | Square | Top First | 29.97 fps"
pattern = re.compile(r'''(?![ \w]+: ) ([\w \.]+) ''')
print pattern.findall(string)
Which produces:
Code:
['1920 x 1080 px', '1920 x 1080 px', 'Square', 'Top First', '29.97']
Which is pretty much what I want. I just want the values, delimited by a pipe. When I tried to use '|' as a delimiter it would pick up everything except the last item, probably because there was no terminating delimiter. Since I couldnt use a delimiter this feels ghetto. Is there a better way to do this? Ideally I'd strip off that ' px' as well, but doing that created match objects with one or more null elements.