I need to insert an "If/Then" statement that will require the command to check the string for multiple variables. In other words it needs to say something like this:

If Microsoft.VisualBasic.Mid(txtLine, 18, 1) = "C" or "T" or "G" or "W" Then
    Go do something
End If

After doing some reading, it seems that "Regex" may be the way to correctly write this. However this is a new command to me and I'm not sure how to write something like this. Can you give me a hand?

In advance, thanks for the help.


Minimalist, You're probably on the right track for me. However I'm not sure I understand "Select Case" even after reading as I'm not sure how to incorporate this in my If/Then statement. This is because my statement is going to be somewhat complex.

I think I will mark this solved and resubmit the question as "If/Then and Select Case".

There is an addin tool available for versions of Visual Studio up to 2012 that will allow you to easily test your regular expressions. You can find it here

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.