You need to sign in to do that
Don't have an account?
Andrea Bruman
pattern.compile US phone number
Hi,
I am trying to validate a phone number contains 10 numbers. Salesforce reformats the number to include the parentheses and hyphen. Here is what I have so far
Help!
I am trying to validate a phone number contains 10 numbers. Salesforce reformats the number to include the parentheses and hyphen. Here is what I have so far
if (newCase.NOI_Primary_Contact_Phone_Number__c <> null && newCase.NOI_Primary_Contact_Phone_Number__c <> '') { String strP = newCase.NOI_Primary_Contact_Phone_Number__c.trim(); Pattern pceP = Pattern.compile('^(?=.*?[1-9])[0-9()-]+$'); Matcher mceP = pceP.matcher(strP); if (mceP.matches() == false) { isValid = false; chkPhone = true; } }It is not working for a phone number format that should work, example- (789) 456-1230
Help!
Mark as best answer, If it resloves !!
check these link for more info
https://developer.salesforce.com/forums/?id=906F00000009FN3IAM (http://https://developer.salesforce.com/forums/?id=906F00000009FN3IAM)
Mark as resloved if it helps :) :)
Thanks,
Bhanu Prakash
visit ForceLearn.com (https://www.forcelearn.com)