// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class AttribParse {
    private static Pattern p = Pattern.compile("(?:<currency\\s+code\\s*=\\s*\")([^\"]*)(?:\"\\s+desc\\s*=\\s*\")([^\"]*)(?:\"\\s+rate\\s*=\\s*\")([^\"]*)(?:\"\\s*/>)");
    public static void test(String s) {
        System.out.println(s);
        Matcher m = p.matcher(s);
        while(m.find()) {
            System.out.println(m.group(1));
            System.out.println(m.group(2));
            System.out.println(m.group(3));
        }
    }
    public static void main(String[] args) {
        test("<currency code=\"EUR\" desc=\"Euro\" rate=\"745,17\" />");
    }
}
