Re: Delimit URL end to space or newline

From: Gnarlodious (gnarlodious_at_yahoo.com)
Date: 03/27/05


Date: Sun, 27 Mar 2005 15:08:53 GMT

Entity Ed Morton spoke thus:

>> Iım having a hard time delimiting the end of a URL, where it might end with
>> either a space or a newline:

> Instead of using ".*" as the last part of the pattern, specify you want
> a sequence of non-spaces:
Ah... so it reads the remainder of the string to a real-life delimiter.
 
> sed 's|\(http.*\..\{2,4\}/\)\([^[:space:]]*\)| <a
> href=\"\1\2\"target=\"_new\">\1</a>|'

I had not used a "character class" in OSX before but it does work. Very
cool.
 
> The [:space:] character class includes tabs, blanks and newlines (see
There's an erroneous dot and right parentheses at the end of that URL so it
didn't parse:
> <http://www.gnu.org/software/gawk/manual/gawk.html#table_002dchar_002dclasses>
Good info, thanks.

-- Gnarlie
"And those who were seen dancing were thought to be insane by those who
could not hear the music."--Nietzsche



Relevant Pages

  • Re: text control
    ... However, you can also specify a "negative" character class, e.g. ... CharsToKeep As String) As Variant ... Dim strIn As String ...
    (microsoft.public.access.gettingstarted)
  • Re: regular expression strangeness
    ... If you take your example above and remove the first pattern ... Use of uninitialized value in concatenation or string at D:\UseNet ... character class not containing the character ']' but perl can't find the ... the capture variables always exist. ...
    (comp.lang.perl.misc)
  • Re: whats wrong with this OR statement syntax
    ... It also matches black and '|'. ... character class so that $color matches if it contains any ... contains blue and any string that ends in green. ...
    (comp.lang.perl.misc)
  • Re: Trouble with m///g
    ... > I'm trying to extract all four-digit numbers from a string in one fell ... > Here's one attempt that I thought had a reasonable chance. ... The first character class requires that the number is preceeded by a ... Read about extended patterns in "perldoc perlre". ...
    (perl.beginners)
  • Re: double eval?
    ... In a character class,. ... It will fail to match any string containing any other ... shell command requiring whitespace. ... pass bad stuff to a shell, since there isn't any shell involved. ...
    (comp.lang.perl.misc)