On Wednesday 03 Nov 2010, Uri Guttman wrote:
>
> try: 'EEEEE123EEExyz'
>
> your \b at the end also breaks many cases.
>
> perl -le 'print $1 if ("EE123EExyz" =~ /.*(E)\d*\b/)'
> perl -le 'print $1 if ("EE123abc" =~ /.*(E)\d*\b/)'
> perl -le 'print $1 if ("EE123EExyzE" =~ /.*(E)\d*\b/)'
> E
>
> the first two print nothing but the OP wants the last E.
>
Oh! the conditions I considered were entirely different (from one of his
examples). Not sure why I did that.
To find the last E, just the following simple regex would do, right?
/.*(E)/
or did I miss another important criteria? If so, please excuse me for I'm
probably not concentrating enough now. Might be because it's being late night
over here. Good nite/day!
--
Regards,
Akhthar Parvez K
http://www.sysadminguide.com/
UNIX is basically a simple operating system, but you have to be a genius to
understand the simplicity - Dennis Ritchie
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/