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
Meli PerronMeli Perron 

I'm trying to build a formula that does the same thing as this RegEx function: (.+?).[a-z]{2,63}$

I want to strip out anything to the right of the first "."  in a website or email so that navy.mil.jp would output only navy

How can I do this in Salesforce since RegEx cannot be used to create a formula field?  
Best Answer chosen by Meli Perron
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Meli,

Can you please check if below formula works.
 
MID( Email , FIND("@", Email )+1 , FIND(".", Email, FIND("@", Email)) - FIND("@", Email)-1 )

If this solution helps, Please mark it as best answer.

Thanks,
 

All Answers

Sai PraveenSai Praveen (Salesforce Developers) 
Hi Meli,

Can you please try the below formula and check if it is useful.
 
LEFT(Email, FIND(".",Email)-1)

If this solution helps, Please mark it as best answer.

Thanks,
 
meli1.3950855704202322E12meli1.3950855704202322E12

Hi Sai Praveen. That formula didn't work. Email was milo@sargento.com.jp, and your formula output mili@sargento. 

can you get rid of everything except "sargento"?

Sai PraveenSai Praveen (Salesforce Developers) 
Hi Meli,

Can you please check if below formula works.
 
MID( Email , FIND("@", Email )+1 , FIND(".", Email, FIND("@", Email)) - FIND("@", Email)-1 )

If this solution helps, Please mark it as best answer.

Thanks,
 
This was selected as the best answer
Meli PerronMeli Perron
That worked!  thank you so much!
Meli PerronMeli Perron
Now they want a similar formula for the Account website.  So, https://www.navy.mil.jp would resolve to just 'navy'.  Is that possible?