Hello I got a problem using the regex with Java.
I'm trying to parse this :
*whatever string* <AttributeDesignator AttributeId="MyIDToParse" DataType="http://www.w3.org/2001/XMLSchema#string" Category="theCategoryIWantToParse" MustBePresent="false" /> *whatever string ***that may contain the same regular expression again*** * using this code (Pattern + Matcher)
Pattern regex = Pattern.compile("AttributeDesignator AttributeId=\"(.+?)\".*Category=\"(.+?)\"", Pattern.DOTALL); Matcher matcher = regex.matcher(xml); while (matcher.find()) { String ID = matcher.group(1); String Category = matcher.group(2); My problem is that my regexp returns only the first occurence of the pattern, even if I have a while(matcher.find())..