RegEx non-capturing group issue

javascript, regex

Solution

(?:v) # matches 'v' this is a non-capturing group, not a lookbehind
.*    # matches 'dd'
(?:v) # matches 'v' this is a non-capturing group, not a lookahead

Non-capturing groups still participate in the match. Perhaps you want a lookahead/behind? But Javascript does not support lookbehind.

Problem

Why following return `["vddv"]` instead of ["dd"]: ``` "aaavddv".match(/(?:v).*(?:v)/) ```

Original source

Related problems