Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 403
  • Last Modified:

Using Regular Expression to convert Double-Quote

Can anyone provide an example of how to remove double-quotes from a string using Regular Expressions?
0
Ray Turner
Asked:
Ray Turner
  • 2
  • 2
1 Solution
 
käµfm³d 👽Commented:
I'm not sure why you'd need a regular expression for this, but it could be:

Dim result As String = System.Text.RegularExpressions.Regex.Replace(original, """", String.Empty)

Open in new window


A simple string replace would do the equivalent:

Dim result As String = original.Replace("""", String.Empty)

Open in new window

0
 
Derek JensenCommented:
Sorry Kaufmed, I don't mean to pretend to know more than you about VB.NET, but don't you want "\"" as your regex string?
0
 
Ray TurnerSenior ConsultantAuthor Commented:
Kaufmed,

Actually I wanted to know how to do the following:

Replace this
" & vbLf & "

With this
Nothing

Can this be done using regular expressions???

That's why I thought it would be nicer with regular expressions.  And it give me a chance to learn regular expressions.

Thanks
0
 
käµfm³d 👽Commented:
@bigdogdman

You're confusing C# and VB.NET. In VB, you escape a quote by using another double-quote.

@rgturner

Please clarify: When you say, "" & vbLf & "", do you mean you have a string like this:

Dim someString As String = """ & vbLf & """

Open in new window


...or like this:

Dim someString As String = "someText" & _
                           vbLf & _
                           "some more text"

Open in new window

0
 
Ray TurnerSenior ConsultantAuthor Commented:
Thanks!
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now