Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {
    public static void main(String[] args) {
        CharSequence inputStr = "q w e r t ";
        String patternStr = "q";
        String replacementStr = "s";
        Pattern pattern = Pattern.compile(patternStr);

        Matcher matcher = pattern.matcher(inputStr);
        String output = matcher.replaceAll(replacementStr);
        System.out.println(output);
    }
}