Hi I have this regex here: (?<=Module Name:\s)((^|)([A-Z] (#|++)?\s|[A-Z] (-)?|(/|,)|[0-9]{1}|\s\w))+(?<=Module Code)
I don want the module code behind!! All word document have this “Module Code” at the next line which will be read in for all my result, how do I not take in the module code words?
@Jovian_Low I think this is because of the fact that you’ve used a positive lookbehind at the end of your regex instead of a positive lookahead. At the end of your regex, remove the ‘<’ in THIS (?<=Module Code) and then re-run your workflow.
@Jovian_Low the first one is something called a lookbehind while the latter is a lookahead expression.
Lookbehind looks BEHIND or BEFORE and matches only whatever you write AFTER that expression, excluding the pattern inside the expression.
Example: (?<=Module Name) Mechanics
This searches for the string “Module Name” but doesn’t include it in your matched string. So it includes ALL the “Mechanics” strings which have a “Module Name” BEHIND them.
Anyway, I suggest you read about lookbehinds and lookaheads, and Regex in general.