84669 orang belajar
152542 orang belajar
20005 orang belajar
5487 orang belajar
7821 orang belajar
359900 orang belajar
3350 orang belajar
180660 orang belajar
48569 orang belajar
18603 orang belajar
40936 orang belajar
1549 orang belajar
1183 orang belajar
32909 orang belajar
光阴似箭催人老,日月如移越少年。
package com.company; import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegExpDemo { public static void main(String[] args) { String[] data = { "interInfo.middNode(buff,\"卡号\",trade.text_借记卡号.getText());\n", "interInfo.middNode(buff,\"1234566790019\",trade.text_1234567890.getText());\n", "interInfo.middNode(buff,\"abcdefg\",trade.text_hijklmn.getText());\n", }; Pattern patternCardNumber = Pattern.compile("\"(\\w+)\"", Pattern.UNICODE_CHARACTER_CLASS); Pattern patternDebitCardNumber = Pattern.compile("trade.text_(\\w+).getText\\(\\)", Pattern.UNICODE_CHARACTER_CLASS); Matcher matcherCardNumber = null; Matcher matcherDebitCardNumber = null; for (String str: data) { matcherCardNumber = patternCardNumber.matcher(str); while (matcherCardNumber.find()) { System.out.println(matcherCardNumber.group(0)); System.out.println(matcherCardNumber.group(1)); } matcherDebitCardNumber = patternDebitCardNumber.matcher(str); while (matcherDebitCardNumber.find()) { System.out.println(matcherDebitCardNumber.group(0)); System.out.println(matcherDebitCardNumber.group(1)); } System.out.println(); } } }
output:
"卡号" 卡号 trade.text_借记卡号.getText() 借记卡号 "1234566790019" 1234566790019 trade.text_1234567890.getText() 1234567890 "abcdefg" abcdefg trade.text_hijklmn.getText() hijklmn
."(.)",trade\.(.*)\);
output:
."(.)",trade\.(.*)\);