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
Shawn ReichnerShawn Reichner 

Help With Regex Formula FIeld

Hello,

I am fairly nwe to the RegEx game and am struggling with the formula needed to extract some text between the first and second / in a string field.  I want to extract the text between the first and second / in the string to then populate a new formula field. 

Here is an example of the string itself that I need to extract info from.... Can anyone please help? 

Auto Launch Failed / Open Space Linda / Nashua, NH / AVI  Development

So in the example above I want to populate my new formula field with only "Open Space Linda"

Hope that makes sense and someone can help me out here.....Thanks in advance


Shawn
Best Answer chosen by Shawn Reichner
LBKLBK
Hi Shawn,

Try this formula.
 
TRIM(MID(YOUR_FIELD_NAME__c, FIND('/',YOUR_FIELD_NAME__c) + 1, FIND('/',YOUR_FIELD_NAME__c, FIND('/',YOUR_FIELD_NAME__c) + 1) - FIND('/',YOUR_FIELD_NAME__c) - 1))
YOUR_FIELD_NAME__c would be the name of the field that is holding your original text.

Let me know if this helps.
 

All Answers

LBKLBK
Hi Shawn,

Try this formula.
 
TRIM(MID(YOUR_FIELD_NAME__c, FIND('/',YOUR_FIELD_NAME__c) + 1, FIND('/',YOUR_FIELD_NAME__c, FIND('/',YOUR_FIELD_NAME__c) + 1) - FIND('/',YOUR_FIELD_NAME__c) - 1))
YOUR_FIELD_NAME__c would be the name of the field that is holding your original text.

Let me know if this helps.
 
This was selected as the best answer
Shawn ReichnerShawn Reichner
LBK, Thank you very much!  That did the trick.  Can you explain a little more as to what exactly is happening? Thanks again
LBKLBK
Try to read about the syntax for MID() and FIND() functions.

These are the functions I have used in this formula.

FIND() provides a number - basically the position of a specific character or the starting of a substring. And, MID() provides a substring of the text from a starting position to an ending position.

I have just found the position of the character next to first / and the position of the charatcer before the second /. And, stripped it out.

Hope this helps.