I got the following scenarios:
1) car on the right shoulder
2) car on the left shoulder
3) car on the shoulder
I want to match "shoulder" when left|right is not present. So only 3) return "shoulder"
re.compile(r'(?<!right|right\s*)shoulder')
sre_constants.error: look-behind requires fixed-width pattern
It seems like I can't use \s* and "|"
How can I solve this.
Thanks in advance!
r'(?<=^i?bs=).+'
, I ended up going withr'^i?bs=(.+)'
and just accessed the first group instead. Sometimes it's pretty easy to work around this limitation. – Miscarriagematch.group(1)
, index zero being the whole match. – Khosrow