in reply to Non White space function

That matches "http://", followed by a space, followed by one or more "S", followed by a space. I think you want

m{http:// (\S+) }x

/x causes white space in the pattern to be ignored. \S is what matches a non-whitespace.


Note that this check if the string in $fragment contains a URL; it doesn't check if the string is a URL. For that, you'd need

m{ ^ http:// (\S+) \z }x

Of course, that not a proper check for URLs. You get false negatives (e.g HTTP://www.perlmonks.org) and false positives. Maybe you should use Regexp::Common::URI::http instead?

Update: Mentioned a specific solution. Thanks, haukex.

Update: In the description, I used /s where I meant /x. Fixed.