I am using regex to find line which starts with 'aaaa'
pattern myPattern = pattern.compile('^(aaaa)\b.*'); String a = 'aaaa,777,ttttt,rrrrrr'; a += '\n' + 'tttttt,ttttt,0000'; matcher myMatcher = myPattern.matcher(a); System.debug(myMatcher.matches()); System.debug(myMatcher.groupCount()); System.debug(myMatcher.group());
System.debug(myMatcher.group()); this line is throwing exception no group is found. I have tested my regex at website https://www.freeformatter.com/java-regex-tester.html
Can any one tell me what i am doing wrong here.