Re: How to exclude a sequence of characters
"Daniel F. Savarese" <[email protected]> Sat, 12 Mar 2011 17:49:32 -0500
| Newsgroups | gmane.comp.jakarta.regexp.user |
|---|---|
| Message-ID | <[email protected]> |
In message <[email protected]>, "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? It sounds like you want to use a zero-width negative lookahead assertion. For example: test(?!-end) I don't believe this is something Jakarta regexp supports. oro and java.util.regex implement zero-width negative lookahead assertions. You should probably use java.util.regex. daniel