Help with Replace Text Regex

Reply
Highlighted
Yellow Belt

Help with Replace Text Regex

Hi!  Struggling to figure out how to replace this: { "value":"Email", "id":"13469" }  with this: Email

 

Any ideas?

Highlighted
Purple Belt

Re: Help with Replace Text Regex

You can utilize a two step regex in a Replace Text block. See the attached images on how it's done. This is under the assumption it's in the same order / format each time.

 

It would be easier if Domo supported RegEx Match Groups so you could easily just utilize the number shortcuts for the groups it matches within parentesis.

 

The other option would possibly utilize the regex functions in your database if that's an option.

 

Screen Shot 2020-01-30 at 8.41.51 AM.png

Make sure you select RegEx from both gear wheels under the search term



**Was this post helpful? Click the heart icon**

**Did this solve your problem? Accept it as a solution!**
Highlighted
Yellow Belt

Re: Help with Replace Text Regex

Unfortunately,Screen Shot 2020-02-04 at 4.12.32 PM.pngScreen Shot 2020-02-04 at 4.11.58 PM.png this did not work.  I made sure that regex was selected for both options... here's a screen shot of what I included in the ETL step and the output....  any other ideas?

Highlighted
Black Belt

Re: Help with Replace Text Regex

I would suggest using this RegEx under the term to search for:

 

^{"value"\s*:\s*"(.*)",.*}$

 

And put $1 in the Replace field.

 

You'd only need one entry that way. It will capture everything after the colon and quote and before the following quote. Can you give that a try and see how that goes?

Highlighted
Purple Belt

Re: Help with Replace Text Regex

You might also need to have a space inbetween the first { and the "

 

^{ *"value"\s*:\s*"(.*)",.*}$

This version would handle if there is a leading space or not.



**Was this post helpful? Click the heart icon**

**Did this solve your problem? Accept it as a solution!**
Highlighted
Yellow Belt

Re: Help with Replace Text Regex

It doesn't like the regex.  Have a look at the screenshot.  Screen Shot 2020-02-04 at 5.11.45 PM.png

Highlighted
Yellow Belt

Re: Help with Replace Text Regex

I tried it with the space as well.  No dice.

Highlighted
Black Belt

Re: Help with Replace Text Regex

Sorry, my fault... I forgot to escape the curly braces. The RegEx engine that MagicETL uses will require that.

 

^\{\s*"value"\s*:\s*"(.*)",.*\}$

Highlighted
Yellow Belt

Re: Help with Replace Text Regex

Still not working.  Unfortunately.

Highlighted
Black Belt

Re: Help with Replace Text Regex

Very odd... It worked in my testing with the example you provided. Can you post some screen shots of what you're seeing now, or give some more detail around how it isn't working?

Announcements
Win free lodging at Domoapalooza! We want you to share you favorite Domo tips and tricks. Click here for more details!