good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Non White space functionby ikegami (Patriarch) |
on Jul 17, 2020 at 21:21 UTC ( [id://11119466]=note: print w/replies, xml ) | Need Help?? |
That matches "http://", followed by a space, followed by one or more "S", followed by a space. I think you want
/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
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.
In Section
Seekers of Perl Wisdom
|
|