Help with Replace Text Regex
Comments
-
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.
Make sure you select RegEx from both gear wheels under the search term
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**2 -
Unfortunately, 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?
0 -
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?
0 -
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 Agree or Like below**
**Did this solve your problem? Accept it as a solution!**1 -
It doesn't like the regex. Have a look at the screenshot.
0 -
I tried it with the space as well. No dice.
0 -
Sorry, my fault... I forgot to escape the curly braces. The RegEx engine that MagicETL uses will require that.
^\{\s*"value"\s*:\s*"(.*)",.*\}$
2 -
Still not working. Unfortunately.
0 -
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?
0 -
sure. Here goes.... First Image is output. Second image is what we did.
0 -
I wonder if we're seeing some whitespace after or before the value. What if you added in a check for that like this:
^.*\{\s*"value"\s*:\s*"(.*)",.*\}.*$
0 -
deleted (dupe)
0 -
Still no dice. I copied your code in, reran and took a screenshot of the output. Still not replaced. See:
0 -
For anyone else running into this issue, you need to select the "Use RegEx" option from the field settings where you add your actual RegEx. It won't work until you do this.
1 -
Just in case you want to parse multiple objects gracefully. You can do this in MySQL. but actually Magic 2.0 with a little creativity supports a similar workflow with the Add Formulas tile.
Jae Wilson
Check out my 🎥 Domo Training YouTube Channel 👨💻
**Say "Thanks" by clicking the ❤️ in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 754 Beast Mode
- 61 App Studio
- 41 Variables
- 693 Automate
- 178 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive