java - Need help with regular expression when only one number changes in string -


how check in java regular expression if string matches

monday ptnumber operating mode 

where number ( after pt ) has concrete value 0,1,...99,.. - integer? mondaypt , operating mode hardcoded number can change in string.

this extract number.

string input ="monday pt23 operating mode"; pattern p = pattern.compile("monday pt([0-9]+) operating mode"); matcher m = p.matcher(input); boolean found = m.find(); if (found) {     string number = m.group(1);     system.out.println(number); } 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -