Help with Regular Expression

simpleonline

Active member
Joined
Sep 13, 2011
Messages
33
Programming Experience
Beginner
Hey guys does anyone know what the Regular Expression would be to match a link and then everything after an = sign?
Example.
If I wanted to match:
everything after the k in this example
k=6Lc4KcMSAAAAAIrokS2JikdI-x4ApVbh1xV2v_K1"
The k and the = sign is always going to be the same as well as the " at the end of the line.
What would be the proper Regular Expression in VB.NET to match the numbers and letters after the k=andeverythinginhere"
There will be numbers so I figured I would use the 0-9 and there will be both upper case and lower case letters so I figured i would use the a-z, A-Z and there are also going to be - and _ symbols to use so I would use some sort of escape key but not sure who to put all this together.
Any ideas on the Regular Expression for this type of capture?
Here is what I have right now but it doesn't produce a result.
VB.NET:
        Dim value As String = "k=6Lc4KcMSAAAAAIrokS2JikdI-x4ApVbh1xV2v_K1"
        Dim m As Match = Regex.Match(ResponseIT.Text, "k\=[a-z,A-Z,0-9]", RegexOptions.IgnoreCase)
        If (m.Success) Then
            Dim key As String = m.Groups(1).Value
            MessageBox.Show(key)
        End If
 
I'm going to answer the same thing I answered in that other thread you started with the same question:

key = value.SubString(value.IndexOf("=") + 1)

Why use RegEx if it's slower, needs more code, and you don't understand how to use it?
 
Back
Top