Friday 1 December 2017

How to define single backslash in Java Regex | Java Regular Expressions | Regex in java


Click here to watch in Youtube :
https://www.youtube.com/watch?v=Puu68Cs1Pv0&list=UUhwKlOVR041tngjerWxVccw

Click the below Image to Enlarge
How to define single backslash in Java Regex | Java Regular Expressions | Regex in java
RegexDemo.java
import java.util.regex.Pattern;

public class RegexDemo
{
    public static void main(String[] args)
    {
        /*
         * If you want to define \d, then you must be using \\d in
         * your regex.
         */
        System.out.println(Pattern.matches("\\d*", "245")); // true
    }

}
Output
true

Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/RegexDemo_backslash.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/RegexDemo_backslash

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/950c9f162cb72194a90be45ab9293fca2b84f41c/BasicJava/RegexDemo_backslash/?at=master

See also:
  • All JavaEE Videos Playlist
  • All JavaEE Videos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • Kids Tutorial
  • No comments:

    Post a Comment