in reply to Another Regular Expression Question

$text =~ s/.*?(\w+)\.pm/$1/i; Though I'd be more inclined to match and assign $1 somewhere rather than modify in place.

Replies are listed 'Best First'.
Re: Re: Another Regular Expression Question
by Roy Johnson (Monsignor) on Apr 08, 2004 at 16:03 UTC
    Should be [^\\] instead of \w.

    The PerlMonk tr/// Advocate
      Depends on your assumptions. Might be better to do something like [^\\/:]. (Most people can leave out : though.)

      I should have been clearer about that.

Re: Re: Another Regular Expression Question
by Scarborough (Hermit) on Apr 08, 2004 at 15:07 UTC
    Thank you, I had seen this before but it had gone from my fried mind. Thanks again.