Everyone keeps giving regular expressions which include provision for the
characters before the '_'. No need. This will do nicely:
m/_$/ ...or just /_$/
Means: "Match a string that has '_' as the last character". You don't need to
explicitly deal with the preceeding characters if there is no '^' anchor at the
beginning and you don't need to match them if you are not capturing them.
dv
> -----Original Message-----
> From: Matt Cauthorn [mailto:[EMAIL PROTECTED]]
> Sent: Monday, April 16, 2001 2:25 PM
> To: [EMAIL PROTECTED]
> Subject: Re: regular expression match?
>
>
> It REALLY helps me to verbally walk through a regex.
> Your original one (m/$\w+\_/) says something like:
>
> "match the end of the line ($) followed by one or more
> word characters followed by ??? Not sure, because the
> "_" doesn't need to be escaped. If you want to match
> *any* string with the last character of "_", you could
> do something like:
>
> /.*_$/ which says "zero or more characters followed by
> a literal "_" followed by the end of the line.
> Remember that this regex will suck anything in with a
> trailing "_"...so maybe /^\w+_$/, which says "the
> beginning of a line, followed by one or more word
> charaters, followed by a "_", followed by the end of
> the line.
>
> Hope this helps: remember to talk your way through
> them step by step...it really helps!
>
> ~Matt C.
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/
>