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.7K Product Ideas
- 1.7K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 295 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.8K Transform
- 97 SQL DataFlows
- 608 Datasets
- 2.1K Magic ETL
- 3.8K Visualize
- 2.5K Charting
- 712 Beast Mode
- 50 App Studio
- 39 Variables
- 668 Automate
- 170 Apps
- 446 APIs & Domo Developer
- 45 Workflows
- 7 DomoAI
- 34 Predict
- 14 Jupyter Workspaces
- 20 R & Python Tiles
- 391 Distribute
- 111 Domo Everywhere
- 274 Scheduled Reports
- 6 Software Integrations
- 116 Manage
- 113 Governance & Security
- Domo Community Gallery
- 31 Product Releases
- 9 Domo University
- 5.3K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 104 Community Announcements
- 4.8K Archive