java - How to extract numbers from a string using regex? -


this question has answer here:

string = "sin(23)+cos(4)+2!+3!+44!"; a.replaceall("(\d+!)","");   current output = sin(23),+,cos(4),+,+,+ 

i want result 2!,3!,44!

please help

    string = "sin(23)+cos(4)+2!+3!+44!";     pattern number = pattern.compile("\\d+!");     matcher matcher = number.matcher(a);     while (matcher.find()) {         system.out.println(matcher.group());     } 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -