Working on a regex in java to find words that follow the below rules
Regex Rules:
Problem:If the above said suffix for the word is a or b or c and followed by a capital N then the regex should ignore that letter and what follows it.Look in test cases for clarification.
Test cases
So far I have
[cpyrau]*[T][0-9X?][a-oqstv-z]{0,2}([N])?(?(1)(?=[abc]))
Which works for the first test case but for all others it includes the letter before N if it is a or c so I'm getting cT4bc and cT3c for second and third test case.
Any help is appreciated.
这是否符合您的要求?
\b[cpyrau]*T\d(?:(?![a-c]N)[a-oqstv-z]){0,2}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.