Reputation: 263
I am trying to find a regex that will return true if a string ends with jaxws.managed
but does not contain delegate
.
For example:
abc/delegate/xyz/jaxws/managed
should return false, while
abc/def/xyz/jaxws/managed
should return true
I tried using the regex
([^(delegate)])+([a-z]*[\\/]jaxws[\\/]managed[\\/])+
but it fails.
Upvotes: 0
Views: 152
Reputation: 1550
If you are using Javascript, you can use this regEx:
**/^((?!(delegate)).)*jaxws\/managed$/**
Upvotes: 0
Reputation: 11
You should specify what regex engine you're using.
Nevertheless...
return false if it contains "delegate" anywhere: /delegate/; -> return false
if we don't return, and it ends in "jaxws/managed", return true: /jaxws\/managed$/; -> return true
if you're using Perl, I suggest applying m{} instead of // to avoid the "leaning toothpick syndrome". Refer to perlre for more information.
Upvotes: 1