StNickolay
StNickolay

Reputation: 960

Regexp capture words which NOT ends with A

wordA - MUST NOT be captured

word - MUST be captured

This doesn't work....

\w+[^A]\b

Why?

Upvotes: 0

Views: 62

Answers (3)

StNickolay
StNickolay

Reputation: 960

actually I found third way which seems works in my case:

\w+[^A\s]\b

Upvotes: 0

kev
kev

Reputation: 161624

[^A] will match space:

hello world
^^^^^^

Try look-behind:

\w+(?<=[^A])\b

If you're working on english words, try this:

\w+[a-zB-Z_]\b

Upvotes: 2

garyh
garyh

Reputation: 2852

Try a negative look-behind:

\w+\b(?<!A)

Upvotes: 0

Related Questions