Reputation: 3
I use test_([^/]+)
but this only ignore the /
character.
I want to give no match if /
found anywhere after test_
.
Example, what I need:
test_apple
matches apple
test_apple/
gives no match.
test_ap/le
gives no match.
How should I do this? Thanks!
Upvotes: 0
Views: 47
Reputation: 9601
You can use a negative lookahead to accomplish this:
(?<=test_)(apple)(?![/])
A Negative Lookahead basically means: "If you find this after this position, don't match."
Upvotes: 0