Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Is there a better way to get the Country names with help of Regax

by Tux (Monsignor)
on Oct 16, 2012 at 05:39 UTC ( #999225=note: print w/ replies, xml ) Need Help??


in reply to Is there a better way to get the Country names with help of Regax

my ($location) = m{\b Location: (?:[a-zA-Z]-)? (\S+) }x;


Enjoy, Have FUN! H.Merijn


Comment on Re: Is there a better way to get the Country names with help of Regax
Download Code
Replies are listed 'Best First'.
Re^2: Is there a better way to get the Country names with help of Regax
by tobyink (Abbot) on Oct 16, 2012 at 05:57 UTC

    It would be good to see more sample input to figure out how countries with spaces in their names should be dealt with. North Korea, Vatican City, South Sudan, Timor Leste, Papua New Guinea, etc...

    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

      Thanks Toby...

Re^2: Is there a better way to get the Country names with help of Regax
by Anonymous Monk on Oct 16, 2012 at 07:17 UTC

    Thanks Tux. :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://999225]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (19)
As of 2015-07-28 20:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (258 votes), past polls