function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
Hi ,
I need to have Regex to accpet either of format
(45)3456-3456 (or)
+4564564523434 ->size can be more than 10 digit but with + sign
Please Help out..
Here's the regular expression you need:
String regex = '\\(\\d{2}\\)\\d{4}\\-\\d{4}|\\+\\d+'; system.debug( Pattern.matches( regex, '(42)1234-1234' ) ); system.debug( Pattern.matches( regex, '+12345678901234' ) ); system.debug( Pattern.matches( regex, '(42)1234 1234' ) );
The first two debugs print 'true' and the third one prints 'false'.
If this helps, please mark it as a solution, and give kudos (click on the star) if you think I deserve them. Thanks!
-Glyn AndersonCertified Salesforce Developer | Certified Salesforce Administrator
Here's the regular expression you need:
The first two debugs print 'true' and the third one prints 'false'.
If this helps, please mark it as a solution, and give kudos (click on the star) if you think I deserve them. Thanks!
-Glyn Anderson
Certified Salesforce Developer | Certified Salesforce Administrator