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
d
day2
int42
_
c _
ws_
4
c 4
d4
3
c 3
d3
day3
int43
< 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&6

Imports System.Text.RegularExpressions
Module Module1

  Sub Main
    Dim txt As String ="42 43"

    Dim re1 As String=".*?"	'Non-greedy match on filler
    Dim re2 As String ="\d"	'Uninteresting: d
    Dim re3 As String="(\d)"	'Any Single Digit 1

    Dim r As Regex = new Regex(re1+re2+re3,RegexOptions.IgnoreCase Or RegexOptions.Singleline)
    Dim m As Match = r.Match(txt)
    If (m.Success) Then
        Dim d1=m.Groups(1)
        Console.WriteLine("("+d1.ToString()+")"+"")
    End If
    Console.ReadLine()
  End Sub
End Module

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