Regular Expression :match string containing only non repeating words
Posted
by nash
on Stack Overflow
See other posts from Stack Overflow
or by nash
Published on 2010-05-21T02:59:47Z
Indexed on
2010/05/21
3:20 UTC
Read the original article
Hit count: 258
I have this situation(Java code): 1) a string such as : "A wild adventure" should match. 2) a string with adjacent repeated words: "A wild wild adventure" shouldn't match.
With this regular expression: .* \b(\w+)\b\s*\1\b.* i can match strings containing adjacent repeated words.
How to reverse the situation i.e how to match strings which do not contain adjacent repeat words
© Stack Overflow or respective owner