DEV Community

Ayush Shalya
Ayush Shalya

Posted on

2. The dot(.)

The dot(.) matches anything except a new line.
e.g : Regex Pattern :- .
Test String : Hi everyone.
Sample code in java:
import java.util.Scanner;
import java.util.regex.
public class RegexSearch {
public void Pattern (String Regex_Pattern){
Scanner sc = new Scanner(;
String Test_String = sc.nextLine();
Pattern p = Pattern.compile(Regex_Pattern);
Matcher m = p.matcher(Test_String);
public class Main{
public static void main (String[] args){
RegexSearch obj = new RegexSearch();

you can view the code here also.

Do read my first article about regex.

Top comments (0)