so far I have this
(?:(?![A-Z]{2,}).)*
which matches everything until HTTPHEADER, however I want it to stop when it sees HttpHeader
how to do that?
so if I have string like Http is an HttpHeader
it should match Http is an
so far I have this
(?:(?![A-Z]{2,}).)*
which matches everything until HTTPHEADER, however I want it to stop when it sees HttpHeader
how to do that?
so if I have string like Http is an HttpHeader
it should match Http is an
You could perhaps use this:
^(?:(?!(?:\S*[A-Z]){2}).)+
(?:\S*[A-Z]){2}
will match only if a word has two uppercase characters.
And since this is in a negative lookahead, the match will stop only if a word with two uppercase characters is found ahead.
using Jerry's suggestion and this pattern is much more efficient
^.*(?=\b(?:[^\sA-Z]*[A-Z]){2})
Demo