Regex

Look ahead vs behind

https://javascript.info/regexp-lookahead-lookbehind (opens in a new tab)

Look ahead syntax is:

X(?=Y)

it means "look for X, but match only if followed by Y".

Look behind syntax is:

(?<=Y)X

it means "matches X, but only if there’s Y before it."

Examples

  1. (?:element|component): ("(.*?)") https://stackoverflow.com/questions/3705842/what-does-do-in-regex (opens in a new tab) ?: subpattern is a non-capture subpattern, that said only pattern within the latter () will be matched.