in reply to Re: Regex to detect and remove a linebreak in an URL
in thread Regex to detect and remove a linebreak in an URL

Astonishingly, you are wrong about the character class. [^\w\s] matches characters that are neither words nor whitespace; i.e., punctuation:
$_='o.ne<a>tw/o<b>'; @punks = /[^\w\s]/g; print "<@punks>";
yields
<. < > / < >>
The problem with my example was that I left the /g modifier off the pattern match. I've updated it, and tested it:
while(<DATA>){ /http:\S*[^\w\s]/g and s/\G\n//; print; } __DATA__ there is an http://whatever.com/address/ crossing/line/boundaries.html right in the middle of this nice string.

The PerlMonk tr/// Advocate

Replies are listed 'Best First'.
Re: Re: Re: Regex to detect and remove a linebreak in an URL
by Anonymous Monk on May 20, 2004 at 00:49 UTC

    Hello Roy and others,

    What is the X in:

    s/\G\n/X/

    ?

      Oh, sorry, that was leftover from some testing. I'm just not having a great brain day today.

      The PerlMonk tr/// Advocate