iam trying to get work experience from resume, below code works fine if the text is 2 years 7 months but it does not work with the text 2.7 years.. i just want to get the code if the text would be in both patterns.
String rx = "\\d+\\s+years?\\s+(?:and\\s*)?\\d+\\s+months?|\\d+\\s+(?:months?|years?)";
Pattern ptrn = Pattern.compile(rx);
Matcher m = ptrn.matcher(text);
while (m.find())
{System.out.println(m.group(0));}