Skip to main content
Fightergator
Inspiring
December 14, 2022
Question

RegExp Help With Look Ahead Exclude Group

  • December 14, 2022
  • 1 reply
  • 189 views

I'm building some regex searches and ran into one I can't seem to solve.  I'm searching for all incorrect capitalization and punctuations of Split "S" (the aircraft maneuver).  The expression I'm using is:

[Ss]plit[ -]“?[Ss]”?(?<!Split “S")

The goal is to find all combinations of initial caps and punctuation (space, hyphen, quoteddbl) and using a look ahead to exclude the correct term.  It works great at finding all the variations, but also finds [Split "S]"...ignoring the right double quote punctuation.  I'm having no luck, so thought I'd turn to the experts.

    This topic has been closed for replies.

    1 reply

    Participating Frequently
    July 21, 2023

    Hi,Fightergator
    I don't know your environment, so I wrote a regular expression that works with VS Code searches.
    Try the following regex:

    (?<![a-zA-Z])(?!Split "S")[sS]plit[ -]"?[sS]"?(?![a-zA-Z])