0

I'm trying to execute below regular expression but every time it returns false. When I tried to check online it works. Can anybody help me to out from this?

import java.util.*;
import java.util.regex.*; 
class RegexExample
{
   public static void main (String[] args) throws java.lang.Exception
   {
           final Pattern sPattern = Pattern.compile("((^(20))([0-6]))(((1|2|3)([0-9]{7}))|(([0-9]{2})(1|2|4|5))|(003)([0-9]{8}))");

            if(sPattern.matcher("20189500000001").matches()) 
               System.out.println("Pattern Matches");
            else
               System.out.println("Pattern not match");

   }
}
Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
Sanjay Bhalani
  • 2,424
  • 18
  • 44

0 Answers0