in reply to Re: regex help
in thread regex help

Try this:
while ( <DATA> ) { if ( /browse(\/.*)\// ) { #if the current $_ matches #browse followed by a # / followed by anything #but having to be followed by # another / #then put whatever was found #between the parens in $line my $line = $1; print "$line\n"; } } __DATA__ http://www.url.com/browse/ASP/scripts/homesites/ /browse/ASP/scripts/homesites/ /browse/ASP/scripts/homesites/index.htm
I don't know if you noticed but in your original post browse was misspelled. -Enlil

Replies are listed 'Best First'.
Re: Re: Re: regex help
by Enlil (Parson) on Sep 27, 2002 at 21:09 UTC
    while ( <DATA> ) { if ( /browse(\/.*\/)/ ) { #if the current $_ matches #browse followed by a # / followed by anything #but having to be followed by # another / #then put whatever was found #between the parens in $line my $line = $1; print "$line\n"; } } __DATA__ http://www.url.com/browse/ASP/scripts/homesites/ /browse/ASP/scripts/homesites/ /browse/ASP/scripts/homesites/index.htm
    I meant to put the last \/ inside the parens as you wanted the final / included in the match at the end of the returned string. My mistake.

    -Enlil