0

HI, I am trying to construct a regEx pattern to match a UK tax code.
The pattern i have created is

"^(/BR{1}/|/D0{1}/|/NT{1}/)|^(([Kk]{1}[1-9]{1}[0-9]{2,3})|([1-9]{1}[0-9]{2,3}[LPTYlpty]{1}))"

I thought this would match the codes as BR or D0 or NT or K followed by 3 or 4 digits or 3 or 4 digits followed by L P T or Y.

However it does not work. I am quite new to regex and would be most greatful for any help.

thanks

1
Contributor
2
Replies
3
Views
8 Years
Discussion Span
Last Post by FallenPaladin
0

hi...further info

have played about with the pattern slightly so that it is now

"^(/BR|D0|NT/{1}$)|^(([Kk]{1}[1-9]{1}[0-9]{2,3}$)|([1-9]{1}[0-9]{2,3}[LPTYlpty]{1}$))"

and the second part of the patern works fine....just the BR D0 and NT do not work now.

Thanks for any help

0

Hi there sorry to have waisted your time have solved it...I think...lol pattern now reads

"^(BR|D0|NT)$|^(([Kk]{1}[1-9]{1}[0-9]{2,3}$)|([1-9]{1}[0-9]{2,3}[LPTYlpty]{1}$))"

Thanks for looking

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.