CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions:
Match the last but one pattern in a given string

 



perlwatcher
User

Nov 13, 2009, 1:21 AM

Post #1 of 3 (2970 views)
Match the last but one pattern in a given string Can't Post

 

my $str = "I am in Hyderabad where Hyderabad is in Andhra Pradesh with Hyderabad being the capital";


My question here is ... how do I match the last "Hyderabad" in the above given string?

Thanks in advance,

Arun


FishMonger
Veteran / Moderator

Nov 13, 2009, 5:14 AM

Post #2 of 3 (2962 views)
Re: [perlwatcher] Match the last but one pattern in a given string [In reply to] Can't Post

/.*(Hyderabad)/


ichi
User

Nov 13, 2009, 6:58 AM

Post #3 of 3 (2960 views)
Re: [perlwatcher] Match the last but one pattern in a given string [In reply to] Can't Post


In Reply To

my $str = "I am in Hyderabad where Hyderabad is in Andhra Pradesh with Hyderabad being the capital";


My question here is ... how do I match the last "Hyderabad" in the above given string?

Thanks in advance,

Arun


i don't see any connection here. is "Hyderabad" a constant string? after the last "Hyderabad" is found, then what is the final output?

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives