Question perl \Q equivalent?

kwhy

New member
Joined
Feb 9, 2009
Messages
2
Programming Experience
10+
I'm trying to use like for pattern match, but the strings I'm checking have character array patterns in the string themselves...is there a way to turn that off when doing a check...

example..

VB.NET:
Dim str1 As String = "this is a test[1]"
Dim str2 As String = "this is a test[1] to see [2] if this is * working"

        If str2 Like ("*" & str1 & "*") Then
            MsgBox("match")
        Else
            MsgBox("no match")
        End If

I'd like check to ignore any special characters in str1 and str2...

perl's equivalent would be something like (if I remember correctly)

if (str2 =~ /\Qstr1/) then

the \Q would turn off pattern matching for characters inside str2.

can this be done in visual basic?

System.Text.RegularExpressions.Regex?
 
Back
Top