Regular expression to check complex account no of max length of 18
Conditions:
- max length of account no. is 18 chars
- 1 hiphen is compulsary
- Before 1st hiphen there should be digits between range 1-6
- If second hiphen introduces then there must be atleast 1 digit in between them and one digit after second hiphen
- If there is only 1 hiphen then after 1st hiphen there must be 1 digit
RegEx for above conditions
^(?=[\d-]{3,18}$)\d{1,6}-\d*[-]?\d+$