I am trying to create a Python regex that matches either:
- The start of the string
- The start of a line
- Or a semi colon
Up to here it must be a none consuming of the string.
Once the above is found, then it looks for optional whitespace and then the word import
(which is captured).
The regex (with the mutline and global flags (mg)):
(?<=^|;)\s*(import)
Fails because a look behind must be fixed width in python:
import sadfsda; import asdf sdaf
import asdfas dfasdf
Note: [^] does answer the question, because how do you specify the a fixed width look behind that matches my requirements. This was just one of the many attempts that didnt work.