This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Hi,
Anyone see my mistake?
I have records in Notes History field with this text: [03/28/2013 - 15:07, BY: Chris Juergens] that I am trying to remove from each row.
Have looked into using Replace and Wildcard, but not having any luck removing it.
Formula: Replace([Notes History],"[*]","")
Thank you.
The regex wildcard is the '.' character. Also you need to escape your brackets with '\' since brackets represent regex operations.
Edit, forgot something else:
The REPLACE function searches for an identical string match. You are looking for the function REGEX_REPLACE
Try this:
REGEX_REPLACE([Notes History],"\[.*\]","")
Thanks Michael, I will give it a shot. I should have mentions that I was using formula, not RegEx. I will try this in Regex though.
You can still use Formula!
REGEX_REPLACE() is a function available in the formula tool.
Ah, thanks. I am obviously brand new to RegEx.
That worked, but unfortunately I have multple sets of bracketed text in each row I am trying to remove: (this is all in one record/row)
[04/08/2016 - 16:14, BY: Jessica Reynolds]Verified with Heather - ice machine is working
Resolution: Warranty
[03/22/2016 - 16:39, BY: Jessica Reynolds]
Speaking with Jason - Tech has been out - evaportor needs to be ordered.
This formula looks to be finding the first '[' and the last ']', so I am losing the struck-thru section in the middle that I would like to keep. If there isn't a way to do it, it is not the end of the world. I am having trouble understanding the regex formula, so I might be able to figure it out after I work through it and understand it.
Thanks.
Try to make it non-greedy by adding in a '?'
REGEX_REPLACE([Notes History],"\[.*?\]","")
Heads up that newlines can affect the algorithm as well if you have breaks inside of your text cell.
Thank you so much Michael. No I just have to figure out how it works :)
@michael_treadwell wrote:Try to make it non-greedy by adding in a '?'
REGEX_REPLACE([Notes History],"\[.*?\]","")
Heads up that newlines can affect the algorithm as well if you have breaks inside of your text cell.
Will [\s\S] fix the the newline issue?
@ddye wrote:Thank you so much Michael. No I just have to figure out how it works :)
@michael_treadwell wrote:Try to make it non-greedy by adding in a '?'
REGEX_REPLACE([Notes History],"\[.*?\]","")
Heads up that newlines can affect the algorithm as well if you have breaks inside of your text cell.