Radap
April 15, 2021, 10:13am
1
Hi,
I have this string saved in a data table that I ham scraping from a website:
“Christmas Season- “See You Zoom See You Soon” Online English Storytelling”
I am now trying to replace the double quotes around the “See You Zoom See You Soon” but I can’t seem to be able to do that.
I have tried looking for the following either inside a Contains or Replace function:
Chr(34)
\u0022
\u201C
\u201D
\u201E
But nothing seems to be working.
Can anyone help?
Thanks in advance
Raniero
Actually, those double quotes are different than programming double quotes.
Just use copy that double quote and paste in replace.
Example :
varStr.Replace("“",String.empty).Replace("”",String.Empty)
Just copy paste above as it is and change with your string variable
Adrian_Star
(Adrian Starukiewicz)
April 15, 2021, 10:21am
3
Hi,
try regex to replace:
output = System.Text.RegularExpressions.Regex.Replace(your_String,"(“|”|\")","")
Preview link: regex101: build, test, and debug regex
Radap
April 15, 2021, 10:39am
4
Thanks for the quick response,
I have tried your approach but it didn’t seem to work:
Radap
April 15, 2021, 10:40am
5
Thanks for the quick response, I have tried to use this but it’s giving me a compiler error:
Adrian_Star
(Adrian Starukiewicz)
April 15, 2021, 11:06am
6
Ok, try this:
output = System.Text.RegularExpressions.Regex.Replace(your_String,"[^a-zA-Z -]","")
Preview link: regex101: build, test, and debug regex
prasath_S
(prasath S)
April 15, 2021, 11:17am
7
Hi @Radap
Please try this
Regex Pattern : [\w\d/_$%()&-\]+
And in assign activity store the text
strText - string
mtchColl - matches activity output
strText = string.join(" ",mtchColl.Cast(of match).Select(function(d) d.ToString).toarray)
Adrian_Star:
"[^a-zA-Z -]"
But it will remove all numbers and other characters than words… Unless he is ok with it…
Adrian_Star
(Adrian Starukiewicz)
April 15, 2021, 11:33am
9
Yes,
You have right,
possibly it will be better:
output = System.Text.RegularExpressions.Regex.Replace(your_String,"[^[\p{L}|\p{N}|\s|-]","")
Preview link: regex101: build, test, and debug regex
varStr.Replace(ChrW(&H2018), String.Empty).Replace(ChrW(&H2019),String.Empty).Replace(ChrW(&H201C),String.Empty).Replace(ChrW(&H201D), String.Empty)
This will definitely work. Try and let me know
1 Like
Radap
April 15, 2021, 11:49am
11
Thanks, I have tried this and albeit it might work for the specific string it was excluding other characters present in other strings. ended up using Pravin’s approach at the end.
Thanks for your support, RegEx is something I need to spend some time on.
Raniero
Radap
April 15, 2021, 11:51am
12
this worked for me.
Thanks a lot for your help
system
(system)
Closed
April 18, 2021, 11:51am
13
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.