Rob Dixon wrote:
>
> > This line is what I am having an issue with $dir = $1
> > if
> > /^Dir:\s+(\W\w+\W\w+)/;
> > That will match /your/path but it will not match /your
> > or /your/path/is.
>
> > Is there a better reg.exp. I can use that will match
> > anything with a / in and everything after it so I can
> > have /your our /your/path or even a dir. ten
> > levels deep and it will still match it?
>
>   /^Dir:\s+(\/\S+)/
>
> will capture a slash and all following non-whitespace characters
> after "Dir:" and some whitespace. This should do it for you
> unless you could have spaces in the path?
>
> By the way, use 'chomp' instead of 'chop'. The latter will
> remove the last character from the string whether or not it
> is a newline. The last line of a file may not be terminated
> by a newline and you will lose valid data.

Alternatively use

  /^Dir:\s+([\/\w]+)/

which will match any mixture of word characters or slashes.

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to