// 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.*;

public class FindVal {
    public static void find(String s) {
        Pattern p = Pattern.compile("(?:<[^>]*>)*([^<]+)(?:<[^>]*>)*");
        Matcher m = p.matcher(s);
        while (m.find()) {
            System.out.println(m.group(1));
        }

    }
    public static void main(String[] args) {
        find("<a>1</a>");
        find("<a>1</a><b><c>23</c></b>");
    }
}
