开发者

RegExp to find a specific string not ending with a specific word

开发者 https://www.devze.com 2023-03-30 05:53 出处:网络
I am trying to figure out a RegExp to match the following strings... MyClassSetupEngine MyClassExecuteEngine

I am trying to figure out a RegExp to match the following strings...

  1. MyClassSetupEngine
  2. MyClassExecuteEngine
  3. MyClassDatalog

but not the specific string

  1. MyClassSetup

Notice the string #1 includes the string #4 but #1 should be found by the RegExp while #4 should not.

I tried the following (with no success so far):

MyClass(^(Setup).+)

MyClass(?!(Setup).+)

EDIT I'm using C++ with boost 开发者_StackOverflow社区regexp 1.35.0


Try:

MyClass(?!(Setup$)).+

The dollar sign signifies the end of the string.

[Note, this works for Javascript - what language are you using?]

0

精彩评论

暂无评论...
验证码 换一张
取 消