Solved

Using Regular Expression to convert Double-Quote

Posted on 2013-11-15
5
369 Views
Last Modified: 2013-11-16
Can anyone provide an example of how to remove double-quotes from a string using Regular Expressions?
0
Comment
Question by:Ray Turner
  • 2
  • 2
5 Comments
 
LVL 74

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39652481
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
 
LVL 9

Expert Comment

by:Derek Jensen
ID: 39652543
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
 

Author Comment

by:Ray Turner
ID: 39652560
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
 
LVL 74

Expert Comment

by:käµfm³d 👽
ID: 39652606
@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
 

Author Closing Comment

by:Ray Turner
ID: 39654071
Thanks!
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now