string - Efficicient way for Java pattern Matching -


what best , fastest way check if string matches like:"ab+space+number+anything eg: "ab 1234 defg" looking efficient way, going compare thousands of transaction per minute.

use string.matches function uses regex string matching.

string.matches("ab \\d+.*");                 ^ ^  ^ ^                 | |  | |_                ab | num                   |                 space 

if want space after number, use

"ab \\d+ .+" 

Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -