In Java I am currently learning about the regular expressions syntax, but I don't really understand the RE patterns...
What I know is patterns have group length and for the string pattern below there is a length of 3.
import java.util.regex.*;
public class RE {
public static void main(String[] args){
String line = "Foo123";
String pattern = "(.*)(\\d+)(.*)"; //RE Syntax I get stuck on.
Pattern r = Pattern.compile(pattern);
Matcher m = r.matcher(line);
if (m.find()) {
System.out.println(m.group(0));
System.out.println(m.group(1));
System.out.println(m.group(2));
System.out.println(m.group(3));
}
}
}
I would be like it if someone would explain to me what this expression does what does more than one group do etc...