If someone types webadress twice by wrongly i want to find the duplicate webaddress using regex. Example:
http://stackoverflow.com/questions/ask/advice?http://stackoverflow.com/questions/ask/advice?
It should throw an error.
I check the rule \b(\w+)\s+\1\b, it's not working for me.
Can someone help me to find the rule?
This won't work because
(\w+)is just for characters.Looks like you want to search for non-whitespace characters in a string that starts with "http://"
You could do that like this:
\b(http://\S+)\s*\1