You are viewing limited content. For full access, please sign in.

Question

Question

Pattern matching suppress text

asked on February 4, 2021

I am trying to pattern match on the following text.  

By:First Last (First.Last@domain.org)

 

But, I want to extract the following, First.Last@domain.org.

I am using the following, (By:First Last\W(\S+))

 

But I am getting this result? 

By:First Last (First.Last@domain.org)(First.Last@domain.org)

 

I appreciate any assistance.

0 0

Replies

replied on February 4, 2021

It's the extra parentheses. They indicate match groups (ie, what you want extracted). Using just By:First Last\W(\S+) will return (First.Last@domain.org), so you'll want to specify that the literal parentheses in your string should also be outside of the match group: By:First Last\W\((\S+)\)

0 0
replied on February 5, 2021

Thank you. That worked perfect!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.