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

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -