I need help to generate regex so that it will match any string which has following detail correct:
- String should end with bracket and only numbers inside it.
- End bracket should appear only once at the end of line and not any where else.
- Any characters are allowed before bracket start
- No characters are allowed after bracket end
- String should contain only 1 set of brackets with numbers, i.e. no double brackets like (( or ))
I have tried this .\([0-9]+\)$ but this is not what i required.
For example:
Following string should match:
asds-xyz (1)
asds+-xyz (12)
as@ds-xyz (123)
Following strings should not be matched:
asds-xyz ((1)
asds-xyz ((12sdf))
(123) asds-xyz
xyz ((2)
XYX (1))
XYZ (1)(2)
xyz(1)BXZ
xyz(1)BXZ(2)