[Solved] Regular expression match against a string (blue:bar AND darkblue:foo) to darkblue
[ad_1] These are some patterns that I have written that work (in order of least efficient to most efficient in terms of “step count”): Step counts are based on this sample input: (green:bar AND black:foo) (blue:bar AND darkblue:foo) (yellow:bar AND grey:foo) (greengarden:bar AND red:foo) /(?:red|blue|green)(*SKIP)(*FAIL)|[a-z]+(?=:)/ Demo (513 steps) /\b(?!red:|blue:|green:)[a-z]+(?=:)/ Demo (372 steps) /(?<=\(|AND )(?!red:|blue:|green:)[^:]*/ Demo … Read more