skcrpk skcrpk -3 years ago 165
Vb.net Question

regex pattern number inside brackets (int)

Have a text


hjgv ygkuy (1) erg erg ewr (2)erg erg erg er. (3)


want to get 1,2,3 and if there is only one then just 1

i have tried with
(\d)\)


i get matches but i want the result like

1,2,3

if just one then just that digit 1

http://rubular.com/r/xDP7h7IRn7

Answer Source

Try using capturing groups;

(?:\()(\d+)(?:\))

Demo

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download