in reply to Regex Question
This might be easiest:
$field =~ s/((.)(?:\\|\/)(.))/ if ($2 eq 'C' && $3 eq 'O') { $1 } elsif (ord($2) >= ord('0') && ord($2) <= ord('9')) { $1 } elsif (ord($3) >= ord('0') && ord($3) <= ord('9')) { $1 } else { "$2 & $3" } /xeg;
Update: I had a "==" where I needed a "eq". Also fixed the problem Roy found.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex Question
by Aristotle (Chancellor) on Nov 15, 2005 at 20:02 UTC | |
by ikegami (Patriarch) on Nov 15, 2005 at 20:11 UTC | |
|
Re^2: Regex Question
by Roy Johnson (Monsignor) on Nov 15, 2005 at 20:16 UTC |