I am trying to build a regular expression that evaluates the value enter to determine the blocks within the text. I have grouped the blocks. This Regular Expression will evaluate the Account ID entered in Various pattern.
The AccountID is composed in the following way: [Prefix] + [Account Number] + [Account Type] + [Joint Account Number]
- [Prefix] = [A-Za-z] but not mandatory
- [Account Number] = All numbers \d; Can range from 2-9 in length; Mandatory
- [Account Type] = [A-Za-z];can be 1-2 length but not mandatory
- [Joint Number] = \d; can be 1-2 in length but not mandatory
My Reg Ex:
(?<prefix>JKB)*\w*\s*(?<number>\d+)*\w*\s*(?<suffix>\W*)*\w*\s*(?<joint>\d*)
So I compiled some values for A/c JKB999LI00 in how users can write it:
9999LI JKB9999LI00 JKB/999-LI/0 9999 LI JKB 999 LI 00 9999LI 0 9999LI1 JKB000009999LI01 JKB-999-LI-00
I noticed that not all are placing in the group. What am I doing wrong here?
NB: Sorry I am unable to share my work done from http://regexstorm.net/ as I couldn't find a share button.
