[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to match last part of fullpath in apt-file with a perl reg-exp?



I think 'm[^/]*$' will match (parse) all end-parts that begin with 'm'.
I think '.*/m[^/]*$' will match (find) all full-paths that have an end-part that begins with 'm' (or either of: 'm' or 'M' if 'i' flag is used).
I addressed parsing, not finding.
In javascript,
regExp=/.*\/m[^\/]*$/i;
would return (as $1) either null (not found) or the whole full-path. Note that the regExp assignment is delimited by '/.../<flags>;'
...see why I had '\/' instead of just '/'?
I've not done much with perl in many years.

Ciao.

On 2013/2/24 8:06 PM, Πρεκατές Αλέξανδρος wrote:
a small correction of mine. i wanted to match not only last part but beggining
of last part . so your solution is ok and thanks. Based on it with a small
addition i can match the beggining of the last part of full path.

So:

'm[^\/]*$' (why \ needs quoting? , i think is not special character  in perl
reg exprs)

'm[^/]*$' it will also match /bla/bla/blma

And to match the beginning of the last part of full path :

'.*/m[^/]*$




Reply to: