S
simon_s_li
Hi,
I am trying to extract some letters from a piece of string, but I do
not know how many letters I need to extract.
All I know is that there are letters that follow the letter:
Example:
At the moment I am using the following regualr expression:
(XX|YY)(\w\w)(\d{1,15})
Two example strings are:
EXAMPLE 1 - XXAB123456789
EXAMPLE 2 - YYABC123456789
I know I can get the XX or YY
However in both example strings I need to get AB or ABC.
However my regular expression (XX|YY)(\w\w)(\d{1,15}) will only get AB
in EXAMPLE 1 which is correct
but it will only get AB in EXAMPLE 2 and not ABC.
If I use (XX|YY)(\w\w\w)(\d{1,15}) it will get AB1 in EXAMPLE 1 rather
than AB.
Can anyone help me?
Regards
Simon
I am trying to extract some letters from a piece of string, but I do
not know how many letters I need to extract.
All I know is that there are letters that follow the letter:
Example:
At the moment I am using the following regualr expression:
(XX|YY)(\w\w)(\d{1,15})
Two example strings are:
EXAMPLE 1 - XXAB123456789
EXAMPLE 2 - YYABC123456789
I know I can get the XX or YY
However in both example strings I need to get AB or ABC.
However my regular expression (XX|YY)(\w\w)(\d{1,15}) will only get AB
in EXAMPLE 1 which is correct
but it will only get AB in EXAMPLE 2 and not ABC.
If I use (XX|YY)(\w\w\w)(\d{1,15}) it will get AB1 in EXAMPLE 1 rather
than AB.
Can anyone help me?
Regards
Simon