DEV Community


2. The dot(.)

Ayush Shalya
I am a B.Tech student and I love to share my knowledge with everyone in a very simple an easy way.
・1 min read

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.

Discussion (0)