Reputation: 23
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.
Upvotes: 2
Views: 454