MadhatterWales,
You need to be looking at regular expressions. If your input string is always a consistant pattern, then you can code a single expression to unpick the whole pattern, but if the input varies in pattern, then some form of loop will be required.
An example of some code handling your example is
Code:
$TestString="AB123QW12";
$TestString =~ /^(\D)+(\d)+(\D)+(\d)+$/;
$Variable1 = $1;
$Variable2 = $2;
$Variable3 = $3;
$Variable4 = $4;
Please forgive an errors in this, I've just written it and I don't have any compilers installed to test it! Please note, I often place the '+' character inside of the ')' when they should be outside. So if this doesn't work, try moving the '+' characters inside the ')' character.
The
/^(\D)+(\d)+(\D)+(\d)+$/ string is the regular expression that unpicks the $TestString scalar. More information on what this regular expression is doing can be found
here. A side effect of this instruction, is to set scalars $1..9 to the different matched patterns in each of the '(' and ')'.
I hope this helps,
Fivesidecube.