Example 1: Implementation of Java Regular Expressions
KW.java
Output
kodingwindow@kw:~$ javac KW.java
kodingwindow@kw:~$ java KW ____________________________________ Implementation of Regular Expression ____________________________________ Enter a number KW Error: number unacceptable ____________________________________ kodingwindow@kw:~$ java KW ____________________________________ Implementation of Regular Expression ____________________________________ Enter a number 12 Number accepted ____________________________________ kodingwindow@kw:~$
Example 2: Implementation of Java Regular Expressions
KW.java
Output
kodingwindow@kw:~$ javac KW.java
kodingwindow@kw:~$ java KW ____________________________________ Implementation of Regular Expression ____________________________________ Enter your 6-digit PIN code -23566 Please enter digits only ____________________________________ kodingwindow@kw:~$ java KW ____________________________________ Implementation of Regular Expression ____________________________________ Enter your 6-digit PIN code 400099 Congratulations! your PIN code accepted successfully. ____________________________________ kodingwindow@kw:~$
Advertisement