Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.regex.Pattern;
import java.util.regex.Matcher;

public class Main {

    public static void main(String[] args) {
        Pattern pattern = Pattern.compile("<Mark([^>]*)>");

        String myString = "this is a test <Mark this is a test> " + "<i>a</i> <Mark t> <b>x+y</b> <Mark 123>";
        Matcher matcher = pattern.matcher(myString);

        while (matcher.find()) {
            System.out.println(matcher.group(1));
        }
    }
}