In message , "Thomas Wiedmann" writes:
>May be, but what's the solution, i. e. how must the RegExp statement be
>written, that texts like "mytext-end" are not matched?
I already answered your question. You confirmed firsthand that
jakarta regexp does not support negative lookahead assertions (a
"Jon Gorrono" schrieb im Newsbeitrag
news:AANLkTik9Khsh_MqmFaBD2DB7v9L8pz=qirr8eh93n...@mail.gmail.com...
'-xyz' literal does not match the '-end' literal... if you want to
match any three-character ending you'll need something like '-...' in
the regexp
Also, I can't recall of the dash needs to
'-xyz' literal does not match the '-end' literal... if you want to
match any three-character ending you'll need something like '-...' in
the regexp
Also, I can't recall of the dash needs to be escaped outside a
square-bracket operator pair, but it might be interpreted as a range
operator here.
O
It sounds like you want to use a zero-width negative lookahead assertion.
For example:
test(?!-end)
You should probably use java.util.regex.
I tried the Java statements
String text = "mytest-xyz";
String pattern = ".*test(?!-end)";
System.out.println(text.matches(pattern) ? "Ok" : "NOk
In message , "Thomas Wiedmann" writes:
>Example: Trying to get all matches of the pattern 'test' but excluding all
>matches of the pattern '-end', i. e. if the text contains 'test-end' this
>text location should not be matched.
>
>By which regular expression can this search condition be realized