views:

719

answers:

2

We know that VB string start and end with double quotes " "

So we have to use "" if we want " in VB string.

I wonder if there is a regular expression pattern which will match VB string?.

Thanks.

+1  A: 

Are you trying to detect if the string they entered would be valid if typed into a VB code file? If so the following regular expression should do the trick

^"(("")|[^"])*"$
JaredPar
A: 

What is the context here? You only need to escape quotes to let the compiler distinguish between start/end quotes and quotes which are part of the string data. If the string is read during runtime there's no need for double quotes.

Brian Rasmussen