Link to home
Start Free TrialLog in
Avatar of glenn_r
glenn_r

asked on

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
why?
Avatar of ozo
ozo
Flag of United States of America image

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.
Avatar of glenn_r
glenn_r

ASKER

so whats the test expression look like if i want to find out if the string contains single and/or double quotes?
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial