You need to sign in to do that
Don't have an account?
@DEVS
Why does this RegEx pattern not working in Salesforce ?
Why does this RegEx pattern not working in Salesforce ?
pattern myPattern = pattern.compile('@(microsoft|ms|microsoftsurface|msstore).com');
System.debug(myPattern.matcher('aba@ms.com').matches());
I tested it in https://regexr.com/ and it works !
pattern myPattern = pattern.compile('@(microsoft|ms|microsoftsurface|msstore).com');
System.debug(myPattern.matcher('aba@ms.com').matches());
I tested it in https://regexr.com/ and it works !
find()
Attempts to find the next subsequence of the input sequence that matches the pattern. This method returns true if a subsequence of the input sequence matches this Matcher object's pattern.
matches()
Attempts to match the entire region against the pattern.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_pattern_and_matcher_matcher_methods.htm#apex_classes_pattern_and_matcher_matcher_methods