Test String -
COAW983742892 COBW98374289
Regular Expression -
^(COBW|COaW|COXW)[0-9]+
Matching String is -
COAW983742892
My question is , why it don't match the both strings?
Test String -
COAW983742892 COBW98374289
Regular Expression -
^(COBW|COaW|COXW)[0-9]+
Matching String is -
COAW983742892
My question is , why it don't match the both strings?
 
    
     
    
    Your regex suggests that it should be the start of the String with ^ symbol at the start of regex.
Try this regex -
(COBW|COAW|COXW)[0-9]+
It will match both the strings.
 
    
    You started your regex from ^ (the start of the string), so the only content
likely to be matched is the initial part of your source string.
Remove the starting ^ from the regex and it will match both substrings.
I assume that:
g option,A into a by mistake),
otherwise set i option.