in reply to Perl Problems with Matching Expression Patterns
that is, you start with optional whitespace, then your first term, then some delimiter, then the rest.use strict; use warnings; while (<DATA>) { if (/^\s*(\w+)[\s:"(]+(.+?)[\s");]*$/) { print "FIRST TERM - $1\n"; print "SECON TERM - $2\n"; } } __DATA__ date : "April 27, 2004"; comment : "Copyright (c) 2002 FoodNation Technolo, Inc. "; power_watts : "1pC"; fruits_vegs_food (1.0, pound);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl Problems with Matching Expression Patterns
by EchoAngel (Pilgrim) on Jan 12, 2005 at 21:17 UTC |