function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vijendhar k 25vijendhar k 25 

regular expression help- urgent

Helo all,

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
can you please help me to prepare Pattern 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); }
}

 
jigarshahjigarshah
Use the below regex
String regExpression = '(\!\@\$\%\^\&\(\)+[a-z|A-Z|0-9]{1})';

Please mark the thread as SOLVED and answer as the BEST ANSWER if it helps address your issue.