Strip email address from people picker field

  • 16 July 2021
  • 2 replies
  • 389 views

I thought I saw the answer to this question, but after a long time searching, I was not able to find it.  In a workflow,  I'd like to strip/extract the email address  out of the value returned from a people picker field.  I think I can use a regular expression, but am not sure how to configure it.

For example, I'd like to extract daniel.Smith@domain.onmicrosoft.com out of  i:0#.f|membership|daniel.Smith@domain.onmicrosoft.com.

 

Thank you!

 


2 replies

I figured it out.  For anyone else who is having the same issue, here is what I did to strip out the text i:0#.f|membership| before the email address.


I used the "Replace Substring in String" action.  My values are as follows:



  • Search String = -1;#i:0#.f|membership| - which is all the text in front of the email address

  • Replace String = (leave this blank)

  • String = varEmailString - This is a text variable that holds the string that you want to remove characters from

  • Output = varEmailString - I used the same variable as my String, but a new text variable can be used.


I hope this helps.


 


 


 


 


 

Userlevel 4
Badge +10

There is a more simple way :


in a "set varaible", use the 'advence lookup', select your SharePoint field, and use select your return type for your SharePoint user Field. You can select the Email, display name, login or user ID.



 


 


 


Or and other ways is to extract the Email from the login text with a regex.


The regex is : 


([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+.[a-zA-Z0-9_-]+)

 



 

Reply