
Hi I would like to supply my regular expression with a 'default' value, so if the thing I was looking for is not found, it will return the default value as i have mentioned in the Regular Expressions. Please acknowledge me as soon as possible.
Thanks, K.ManojKumar.

hi friend,
Try the following code snippet may this will be helpful for you
private static final String REGEX = "\\bcat\\b";
private static final String INPUT ="bat";
public static void main( String args[] ){
Pattern p = Pattern.compile(REGEX);
Matcher m = p.matcher(INPUT); // get a matcher object
int count = 0;
if(!(m.find()))
{
System.out.println(p.pattern());
}
}
Thanks.