String should contain digits and atleast one asterisk. Please help me with the regex.
System.out.println(Pattern.matches("\\d", "12345678*")); //true
System.out.println(Pattern.matches("\\d", "1234****")); //true
System.out.println(Pattern.matches("\\d", "123456789")); //false
System.out.println(Pattern.matches("\\d", "abc45678*")); //false
what should be the correct regex pattern ?
I tried different patterns like [0-9](?=.*_). but no luck.
Thank you!