Sunday 2 November 2014

Get regular expression from which this pattern was compiled

public String pattern()
Returns the regular expression from which this pattern was compiled.

import java.util.regex.*;

public class PatternMatch {
    public static void main(String args[]){     
        Pattern p = Pattern.compile("a*b");
        
        System.out.println("Pattern used is " + p.pattern());
    }
}


Output
Pattern used is a*b




 
Prevoius                                                 Next                                                 Home

No comments:

Post a Comment