Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Perl Regex Help!

by choroba (Canon)
on Mar 23, 2013 at 12:04 UTC ( #1025027=note: print w/ replies, xml ) Need Help??


in reply to Perl Regex Help!

If the country code is always all uppercase, you can use the following simple regex:

#!/usr/bin/perl use warnings; use strict; for ('UK-Storee Leaader', 'US-Inventory Specialiist', 'Verifiication Engiineer - Techniical', 'CHN-Speciialist', 'Software Engiineer - Telecom', 'ESP-Busiiness Manager', 'Software Engiineer - Productiiviity', 'FRA-Busiiness Speciialist', 'CAN-Busiiness Speciialist', 'CHE-Inventory Specialiist', 'HK-Iinventory Speciialiist', 'ITA-Speciialist', 'NLD-Busiiness Specialiist', ) { if (/^([[:upper:]]+)-/) { print "Country code: $1 in $_.\n"; } else { print "No country code in $_.\n"; } }
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re: Perl Regex Help!
Download Code
Replies are listed 'Best First'.
Re^2: Perl Regex Help!
by Anonymous Monk on Mar 23, 2013 at 12:36 UTC
    Thank You for your time & help...

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (14)
As of 2015-07-28 12:08 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 (254 votes), past polls