Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Replace second quotation mark(")

busybee
7 - Meteor

I have a string in quotation marks (eg. "Water") but my string value may contain " in the middle ("Wa"ter"). I am trying to write Regex to replace the " surrounded by characters with " - "Wa"ter"

 

REGEX_Replace([String1], '.+(").+', """).

 

However, this is replacing the entire string with ". Can you recommend regex to obtain the results I want? 

7 REPLIES 7
Greg_Murray
12 - Quasar

hi @busybee 

 

You'll want to double check this with other examples in your  data, but this formula works for the one you presented.

 

 

REGEX_Replace([String1], '([^"]*"[^"]*)"(.*)', "$1"$2").

 

 

Greg

morr-co
10 - Fireball

Hi @busybee : here is an option using the regex tool rather than the formula tool. 

 

Screen Shot 2020-11-02 at 2.42.13 PM.png

vizAlter
12 - Quasar

Hi @busybee — Try this solution:

 

Use a RegEx tool with Replace output method like below:

 

(^"\w+)(")(\w+"$)

 

vizAlter_0-1604355622573.png

 

$1"$3

 

 

If this solves your issue please mark the answer "Solved" with a Like, if not let me know!

grazitti_sapna
17 - Castor

Hi @busybee,

 

Here is the solution to your problem.

 

REGEX_Replace([Field1], '([^"]*"[^"]*)"(.*)', "$1"$2")

 

grazitti_sapna_0-1604378943522.png

 

I hope it helps.

 

 

 

Sapna Gupta
atcodedog05
22 - Nova
22 - Nova

Hi 

 

Here is a workflow for the task.

Output:

atcodedog05_0-1604379363770.png

 

Workflow:

atcodedog05_1-1604379378559.png

Formula:

REGEX_Replace([Input], '([[:alpha:]]+)"([[:alpha:]]+)', '$1$2')

 

Hope this helps 🙂


If this post helps you please mark it as solution. And give a like if you dont mind 😀👍

busybee
7 - Meteor

My Input String consists of combinations of alphanumeric and non alphanumeric characters. I had to tweak your suggestion as follows to get the results. 

 

REGEX_Replace([Input], '(.+)"(.+)', '$1"$2')

 

Thank you all for your help. 

atcodedog05
22 - Nova
22 - Nova

Happy to help 🙂 @busybee 

 

Cheers and Happy Analyzing 😀

Labels
Top Solution Authors