?
Solved

vb.net regex with single and double quotes not working

Posted on 2015-02-19
3
Medium Priority
?
210 Views
Last Modified: 2015-02-19
m_strRegEx = "^['"]*$"

' the double quote is detected
?Regex.IsMatch(chr(34), m_strRegEx)

' the double quote is not detected when other characters are assigned to the string
?Regex.IsMatch("a" & chr(34), m_strRegEx)

same problem with single quotes
why?
0
Comment
Question by:glenn_r
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 40619856
Because the ^ says the string must have nothing before the quotes,
and the $ says the string must have nothing after the quotes.

The * also says that the string can have zero quotes.
0
 

Author Comment

by:glenn_r
ID: 40619882
so whats the test expression look like if i want to find out if the string contains single and/or double quotes?
0
 
LVL 84

Accepted Solution

by:
ozo earned 2000 total points
ID: 40619890
Remove the ^, the $, and you probably want to remove the * too.
0

Featured Post

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

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

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 …
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

771 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