Get numbers only from string by using regular expression

Hello guys,

I have following string:

String str= "COO OPP (404) 851-1331 ext. 1520 "

I want to get result as (404) 851-1331 ext. 1520 like this by using regular expression only.
Can anyone provide me exact regular expression for the same.


Why can’t you use substring ?

@Mangesh_kulkarni Try below Regex

String strVariable = System.Text.RegularExpressions.Regex.Match(str,“(?<=COO OPP).+”).ToString


Check this out: \(\d{3}\).*(ext.)\s\d{4}