Solved

vb.net regex with single and double quotes not working

Posted on 2015-02-19
3
189 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
  • 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 500 total points
ID: 40619890
Remove the ^, the $, and you probably want to remove the * too.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This video discusses moving either the default database or any database to a new volume.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

757 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

21 Experts available now in Live!

Get 1:1 Help Now