vb.net regex with single and double quotes not working

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
Who is Participating?
ozoConnect With a Mentor Commented:
Remove the ^, the $, and you probably want to remove the * too.
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.
glenn_rAuthor Commented:
so whats the test expression look like if i want to find out if the string contains single and/or double quotes?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.