Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using Regular Expression to convert Double-Quote

Posted on 2013-11-15
5
Medium Priority
?
401 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 75

Accepted Solution

by:
käµfm³d   👽 earned 2000 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 75

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
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…
Suggested Courses

885 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