This is my first post. I want to extract some special pattern from a String. I searched and found this answer Using Java to find substring of a bigger string using Regular Expression
This was exactly what i needed. Unfortunatly it does not work
My Code looks like this:
String next = ">GID1_seq1 ABW28161.1 lipid-A-disaccharide synthase, putative [Acaryochloris marina MBIC11017]";
Pattern p = Pattern.compile("(?i).*");
Matcher m = p.matcher(next);
if(m.matches()){
Pattern p1 = Pattern.compile("GID\\d*_seq\\d*");
Matcher m1 = p1.matcher(next);
if(m1.matches()) {
System.out.println(m1.group(2));
}
else{
System.out.println("not a match");
}
}
But it does not work i also tried to just match on "GID1_seq1" but also this does not work where is my problem ?
Edit: forget about the m1.group(2) i get "not a match" everytime