The regular-expressions tag has no wiki summary.
3
votes
3answers
80 views
Unable to use multiline with pattern
I'm trying to match a string with Pattern/Matcher, however it is failing because I cannot set Pattern.MULTILINE like the Java documentation uses.
String testString = 'Line 1: Does not match\nCustomer ...
-2
votes
1answer
82 views
Pulling picklist options from a multi-value field
I am currently pulling select options for a multi-value picklist from a query which gathers field values from all of the child records from a certain __r relationship of an account.
I would like to ...
2
votes
2answers
54 views
“REGEX too Complicated” error
Is "REGEX too Complicated" error while attempting to upload a CSV via Apex into SFDC an undocumented limit? What should be the optimal data volume for a CSV upload via Apex? I was trying with 10,000 ...
2
votes
1answer
43 views
Formatting phones to E.164
I'm trying to validate a phone number in the E.164 format using a RegEx, but it doesn't seem to be working.
Here's the RegEx:
java
Pattern e164p = Pattern.compile('\+?\d{10,14}');
Error message:
...
4
votes
1answer
102 views
Get the content between the nearest Square Brackets in a string
In the following string,
['*.*string1*.*'],['*.*String2*.*'],['*.*String3*.*'],['*.*String4*.*],['*.*String5*.*]
how can get the content including the brackets which are in String 4 using Regex ...
6
votes
1answer
143 views
“Maximum stack depth reached: 3” when doing String.replaceAll()
I am getting a strange "Maximum stack depth reached: 3" when doing a String.replaceAll() with bigger Regex on a quite big string (40 lines of text).
I am trying to remove any comments and literal ...
5
votes
2answers
164 views
Regexp to extract parts of ApexClass.Body
I want to calculate some metrics on Apex classes. So I need to somewhat "parse" them with the means that exist in Apex e.g. regexp patterns, groups and regions.
I want to match class declarations ...
5
votes
2answers
103 views
Find out if a given string is Salesforce Id in Java
Is there a way(regex or something) to find out if a given string is a Salesforce Id or not? I'm looking for some helper class in Java.
1
vote
1answer
152 views
Using RegEx Pattern Match to create DateTime fields in trigger
How do I write code with the correct syntax to run a pattern grouping match within a string, then replace the pattern groups found in the result so that they follow a desired pattern? I've never done ...
2
votes
3answers
66 views
RegExp to extract namespace prefix from SObject name
I want to get a potentially empty namespace prefix from arbitrary sobject names by using Regexp. All following cases should be covered:
1. StandardObject
2. CustomObject__c
3. ...
8
votes
2answers
242 views
How do I do a case-insensitive replace all for a string?
I've got a project where I'd like to replicate some of the internal merge field functionality so users can build a link and it'd be really helpful if I could do a case-insensitive string replaceAll.
...
0
votes
1answer
82 views
Regex NullObject in Trigger if run from Dataloader else works fine
Fellow developers,
I have a call to an email validation function in my before insert in my trigger, which basically puts the email blank if its not valid (according to the regex)
public static ...
3
votes
2answers
150 views
Regex replacement efficiency
In a recent question (Remove whitespaces in a string) my solution included using a simple regex replacement (\\s+) to match all instances of double spaces (or more) and reduce them to a single space.
...
1
vote
1answer
280 views
How to validate UTF-8 in regex
I have basic validation rules setup for name fields:
NOT(REGEX(FirstName, "^[A-Za-z\\. '-]+$"))
The goal is to only allow letters, periods, spaces, hyphens and apostrophes in the name field. The ...
2
votes
1answer
737 views
How do I use regular expressions in Apex to extract data from a string?
Assuming an input string is a well formed duration in the form "1hr 30m", how can I get the 1 and 30 out and into their own variables?



