txt 2 re
knowing is obsolete :: regular expression generator (perl php python java javascript coldfusion c c++ ruby vb vbscript j# c# c++.net vb.net)
 
 
 
Enter the string that you want to use a regular expression on:
1
   
 
Select the elements that you want to extract to run regular expression generator:
2
4
c 4
d4
2
c 2
d2
day2
int
_
c _
ws
4
c 4
d4
3
c 3
d3
day3
int
< Source String
What to click?  extract any integer in this position
extract this integer (2006) in this position
 
3Visual Basic regular expression program that extracts the selected elements from the entered string:
Perl PHP Python Java Javascript ColdFusion C C++ Ruby VB VBScript J#.net C#.net C++.net [VB.net] 
 
' URL that generated this code:
' http://txt2re.com/index-vb.php3?s=42%2043&2&11&5&1

Imports System.Text.RegularExpressions
Module Module1

  Sub Main
    Dim txt As String ="42 43"

    Dim re1 As String="(\d+)"	'Integer Number 1
    Dim re2 As String="(.)"	'Any Single Character 1
    Dim re3 As String="(\s+)"	'White Space 1
    Dim re4 As String="(\d+)"	'Integer Number 2

    Dim r As Regex = new Regex(re1+re2+re3+re4,RegexOptions.IgnoreCase Or RegexOptions.Singleline)
    Dim m As Match = r.Match(txt)
    If (m.Success) Then
        Dim int1=m.Groups(1)
        Dim c1=m.Groups(2)
        Dim ws1=m.Groups(3)
        Dim int2=m.Groups(4)
        Console.WriteLine("("+int1.ToString()+")"+"("+c1.ToString()+")"+"("+ws1.ToString()+")"+"("+int2.ToString()+")"+"")
    End If
    Console.ReadLine()
  End Sub
End Module

'-----
' Paste the code into a new Console Application
'-----
 
 
  home     faq              ©2006 mark james ennis