sauloco sauloco - 1 year ago 83
Java Question

Pattern in regexp

I have a pattern like:

string [number|number]

I want validate with RegExp in Java.

Case valid:
"blablabla blabla blabla [12|1234]"

Any other would be invalid.

I don't realise how to do it.

hsz hsz
Answer Source

You can try with following regex:

^[a-zA-Z ]+\[\d+\|\d+\]$
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download