I have a coupon code which dynamically generates with provided prefix
, suffix
and length
I have generated one coupon code with following param :
prefix - NOV Suffix - OFF Length - 10
And coupon NOVQ3QVOFF
generated. I have to validate where it generated with given prefix and suffix. for that I'm using below code:
String couponCode = "NOVQ3QVOFF";
String pattern = "^NOV*";
System.out.println(Pattern.compile(pattern).matcher(couponCode).matches());
But getting output as false
Also tried pattern = "^NOV";
but no success. Also i have validated regex online its matching there.
Can someone please help. whats wrong here ?