
http://www.csse.monash.edu.au/~aland/ALJ/article1Resources.html
I almost wish I hadn't gone down that rabbit-hole — and yet — and yet — it's rather curious, you know, this sort of life!
String input = "something";
String regex="your_reg_ex";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(input);
if (m.find()) { //5. if found, the matched portion will be available at m.group() String found = m.group(); // do whatever u like }
Look-behind group does not have an obvious maximum length near index ..
1 2 String regularExp = "(?<=A).*?(?=A)"; 3 4 String input = "fjkl;pokjhA123ss456Apghkit"; 5 6 Pattern pattern = Pattern.compile(regularExp); 7 8 Matcher matcher = pattern.matcher(input); 9 10 if(matcher.find()) 11 { 12 String parsedData = matcher.group(); 13 System.out.println(" Output ->"+parsedData); 14 } 15