I have this string (example):
"St 28828 En, St 217n En, St 38729mdnj dnj]spw En"
If I run this code...
Pattern patt = Pattern.compile("St(?s)(.*)En");
Matcher matc = patt.matcher(vartext);
boolean found = false;
while (matc.find()) {
found = true;
Log.d("LogCalc", matc.group());
}
if (!found) {
Log.d("LogCalc", "Nothing");
}
I get the entire string, I assume because the very first string starts at St
& the very last ends at En
. How can I get each individual iteration: 28828
, 217n
, 38729mdnj dnj]spw
? I assume there is a way to have the regex pattern start from the beginning.
Thanks,