How to preg_match for an null (empty) string??
I need something like:
/([0-9]|[NULL STRING])/
I had to do this, in java, for the last 4 for a CC number. The field is optional so it could either be empty, or 4 digits. My solution is:
^\d{4}$|^$
The is passing this a null in the typical java fashion results in a null pointer exception:
String myString = null;
last4Pattern.matcher(myString).matches(); //Null in this case.
However, I feel that it is more of a Java implementation problem.