Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

What is wrong with my RegExp pattern?

In my VB script fuction I tried to extract a URL address using Enter key as
one of delimiters. Such as I typed "http://www.hotmail.com", enter twice
and then typed "is a good sample." The objRegExp.value turns out "http://www.hotmail.com<BR><BR>is"
intead of "http://www.hotmail.com".

The RegExp pattern didn't catch Enter key. What is wrong with my RegExp pattern?

objRegExp.Pattern = "((((ht/f)tp(s?))\://)\S+)"

Thanks!
[477 byte] By [kenny] at [2007-11-9 17:49:49]
# 1 Re: What is wrong with my RegExp pattern?
> objRegExp.Pattern = "((((ht/f)tp(s?))\://)\S+)"

Kenny: Try this:

((ht|f)tp(s?))://([^\s][^<]*)

The rightmost parenthetical says, "Include all characters until you reach a
whitespace character or an angle bracket."

I figured this out, incidentally, by trial-and-error at
http://www.dotnetcoders.com/web/Learning/Regex/RegexTester.aspx
--
Phil Weber
Phil Weber at 2007-11-11 23:17:06 >