Click here to watch in Youtube : 
https://www.youtube.com/watch?v=ir-lm9f9uX0&list=UUhwKlOVR041tngjerWxVccw
RegexDemo.java
https://sites.google.com/site/ramj2eev1/home/javabasics/RegexDemo_dot_r.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/RegexDemo_dot_r
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/950c9f162cb72194a90be45ab9293fca2b84f41c/BasicJava/RegexDemo_dot_r/?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 
https://www.youtube.com/watch?v=ir-lm9f9uX0&list=UUhwKlOVR041tngjerWxVccw
RegexDemo.java
import java.util.regex.Pattern; public class RegexDemo { public static void main(String[] args) { /* * Parameters: * * regex - The expression to be compiled * * input - The character sequence to be matched * * Returns: * * whether or not the regular expression matches on the input * */ System.out.println(Pattern.matches(".r", "ar"));//true (2nd char is r) System.out.println(Pattern.matches(".r", "ak"));//false (2nd char is not r) System.out.println(Pattern.matches(".r", "arr"));//false (has more than 2 char) System.out.println(Pattern.matches(".r", "arrr"));//false (has more than 2 char) System.out.println(Pattern.matches("..r", "par"));//true (3rd char is r) } }Output
true false false false trueClick the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/RegexDemo_dot_r.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/RegexDemo_dot_r
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/950c9f162cb72194a90be45ab9293fca2b84f41c/BasicJava/RegexDemo_dot_r/?at=master
See also:
 


 
No comments:
Post a Comment