Reverse reading via regex or grabbing last match with no tail -
i need grab 2 character letter , numbers after that:
what want is:
ab 12 cd-12345-67 -> cd-12345 ab12 cd 12345-67 -> cd 12345 ab-12cd12345-6 -> cd12345 abc1234556 -> no match, 2 character letter , numbers after that. abc-1234556 -> no match, 2 character letter , numbers after that. a1-bc-12d345-56 -> no match, after 2 characters letter, numbers must come
i used regex
[a-z]{2}[ |\-]?\d+
which grabs cd-12345 , ab 12, in first example. need cd-12345. grabs bc1234556,bc-1234556, bc-12 in last 3 example don't want. sometimes, space,no space or - character placed between numbers , letters block.
thank much.
Comments
Post a Comment