in reply to Re: Re: filtering folder path using regex.
in thread filtering folder path using regex.

I think you were talking about this one:
$path =~ /^(\w):\\([^\\]+)\\?/;
In this one [\\] would match just backslashes, but with the ^, [^\\], matches all characters Except backslashes, and because of the +, it matches as much as possible up to the 1st backslash. $2 is populates, because the character class (ie. [^\\]) is in parenthesis, which happens to be the second set of them, so therefore is stored in $2

Replies are listed 'Best First'.
Re: Re: Re: Re: filtering folder path using regex.
by blackadder (Hermit) on Jul 14, 2003 at 20:57 UTC
    Spot on with your explanation kind sir.
    [] and ^ means all Except backslashes,...I confused it with ^ as an anchor or start of a word boundary....I should’ve been more careful when constructing a Regex expressions!…

    Thanks for reminding me....

    & I should always keep practice coding.