Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parse String with PERL [A-Z]

Status
Not open for further replies.

fsaerospace

IS-IT--Management
Feb 20, 2003
3
US
Hey! I need to parse, from <STDIN>, a string such as:

HDFx-GdFs

Each character is a letter and can be lower or upper case.
How do I make this into a regex expression?

here's the code (which isn't setup to parse for exactly this 4 letters, dash, 4 letters setup):

if($line =~ /Testcode.*[\#: ](\w\S+)/){ $etestcode=$1; }
 
Something simple like
Code:
/^[a-zA-Z]{4}-[a-zA-Z]{4}$/
will work.

jaa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top