I need one regular expression pattern, in that i have to verify string contains at least one upper or lower case character or one number i dont have problem with position. if string contains only special charactors it will be invalid. EX :
@#@#@#
- invalid string!@$%^&a
- valid string!@$$*)(&A
- valid string!@$$*)(&1
- valid string
What pattern will work here?
String regExp = '([a-zA-Z0-9]*)';
String[] regExps = new string[]{'@#@#@#','@#@#@#a ','@#@#@#A','@#@#@#1'};
for(string regEx : regExps)
{
//system.debug('regEx== '+regEx);
Matcher m = Pattern.compile(regExp).matcher(regEx);
if(m.matches()) {
System.debug(regEx);
}
}