Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: Perl Regex Help!

by choroba (Chancellor)
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"; } }
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1025027]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2017-07-24 19:31 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (357 votes). Check out past polls.