Maybe something like this:

@line = split /:/, $theLineOfData;
@line = map { s/^'(.*)'$/$1/ } (@line); # removes the ticks

And to match the whole word:

if ( $field =~ /\bBRANCH\b/ ) {
        # matches word boundary
}

Or you could remove the whitespace as well to simply things...

@line = split /:/, $theLineOfData;
@line = map { s/^'\s*(.*?)\s*'$/$1/ } (@line); # removes the ticks

if ( $line[0] eq 'BRANCH' ) {
        # do stuff
}

Rob

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 12, 2002 10:41 AM
To: [EMAIL PROTECTED]
Subject: Regex Help


Here is snippet of data:

'BRANCH      ':'Kurt':'Strothenke'
'BRANCH      ':'Michael':'Mulligan'
'BRANCH_SSC  ':'Kevin':'Oaks'
'BRANCH_SSC  ':'Thomas':'Grove'
'BRANCH_SSC  ':'Stephen':'Orban'
'BRANCH_SSC  ':'Gerald':'Parnell'
'BRANCH_SSC  ':'Liane':'Mcintyre'
'BRANCHADMIN ':'Ann':'White'
'BRANCHADMIN ':'Brent':'Uhl'

2 problems:

1.  I want to remove the tickmarks from fields 1,2,3 and 
put the data into an array using the : as a separator.  
I am having trouble getting rid of the tick marks, 
everything else works fine.

2.  I want to match whole words only.  I don't want to 
BRANCH to match on BRANCH_SSC or BRANCHADMIN.  My code 
currently matches BRANCH with all three. 

Thanks for your help

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to