Quote:
Originally Posted by ElMiko
Normally I'd try to use a combination of lookaheads and lookbehinds to find it, as in:
Code:
(?<=“.*?)\bwere\b(?=.*?”)
But because lookaheads/lookbehinds need a defined character length (I think), the above won't actually work...
|
Lookaheads don't require a defined width. Neither in the built-in re module, nor in the Barnett regex module included with Sigil's bundled python. The Barnett regex module also has the added advantage of allowing variable width lookbehinds as well. Just use "import regex as re" to work with existing code.
But you're right that the built-in re module does not allow variable-width lookbehinds.