ganeshm69 has asked for the wisdom of the Perl Monks concerning the following question:
Basically im trying to come up with a regex which can parse the below strings.
The output should be EC, AB or A.
The strings can have number sometimes like 98, 28.5 and I need to extarct the first 2 characters and if it has a space i should get the first character.
InputString = ("ECX3","ABC3X 98","A B3X 28.5");
$InputString =~ s/(\w |\w+)(\D)(\d)X(\w*|\s*|\d*)$/$1/g;
can some one help.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex Question for parsing a string
by Athanasius (Archbishop) on May 30, 2013 at 03:15 UTC |