10.04.2013, 12:18
I’m trying to use regular expression to match return text from SQL Plus,
I want to skip the ITEM line and also the hyphen line. The number of hyphens will vary depending on the values returned by the SQL script.
I can break the lines into words with:
This test works fine for skipping the ITEM line
But I want to use regular expressions so I can match the hypen line of any length. These are the lines I used, and neither one of the if statements work to skip the lines:
How do I write a perl if statement to completely match a regular expression?
I Am new at perl, so please bear me.
Код:
ITEM COST ----- ------ SHOES $10.99 COAT $24.95
I can break the lines into words with:
Код:
my @wordsOnLine = split (/\s+/, $line);
Код:
if ($wordsOnLine[0] eq "ITEM") {next;}
Код:
if ($wordsOnLine[0] =~ "/^ITEM$/") {next;} if ($wordsOnLine[0] =~ "/^-+$/") {next;}
I Am new at perl, so please bear me.