मैं की तरहजावा regex परिमाणकों
String string = "number0 foobar number1 foofoo number2 bar bar bar bar number3 foobar";
मैं एक regex की जरूरत है मेरा पीछा उत्पादन देने के लिए एक स्ट्रिंग है:
number0 foobar
number1 foofoo
number2 bar bar bar bar
number3 foobar
मैं
Pattern pattern = Pattern.compile("number\\d+(.*)(number\\d+)?");
Matcher matcher = pattern.matcher(string);
while (matcher.find()) {
System.out.println(matcher.group());
}
की कोशिश की है, लेकिन इस
देता हैnumber0 foobar number1 foofoo number2 bar bar bar bar number3 foobar
क्या आपकी स्ट्रिंग में न्यूलाइन हो सकती है? –
हाँ, मुझे पैटर्न जोड़ना था। डॉटल और यह काम करता है। बहुत बहुत धन्यवाद। – b3bop