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
 4
d4
2
 2
d2
day2
int42
_
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
 
3VB6 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-vb6.php3?s=42%2043&2&-13&-11

Private Sub Command1_Click()
  Dim txt As String
  txt ="42 43"

  Dim re1 As String
  re1 ="(4)"	'Any Single Character 1
  Dim re2 As String
  re2 ="(2)"	'Any Single Character 2
  Dim re3 As String
  re3 =".*?"	'Non-greedy match on filler
  Dim re4 As String
  re4 ="(\d+)"	'Integer Number 1

  Dim r As New RegExp
  r.Pattern = re1+re2+re3+re4
  r.IgnoreCase = True
  Dim m As MatchCollection
  Set m = r.Execute(txt)
  If m.Item(0).SubMatches.Count > 0 Then
      Dim c1
      c1=m.Item(0).SubMatches.Item(0)
      Dim c2
      c2=m.Item(0).SubMatches.Item(1)
      Dim int1
      int1=m.Item(0).SubMatches.Item(2)
      MsgBox("("+c1+")"+"("+c2+")"+"("+int1+")"+"")
  End If
End Sub

'-----
' To run this code:
' .Start Microsoft Visual Basic 6.0.
' .On the File menu, click New Project.
' .Click Standard Exe in the New Project dialog box, and then click OK.
' .On the Project menu, click References.
' .Double-click Microsoft VBScript Regular Expressions 5.5, and then click OK.
'   (If you can't find this option, download "Microsoft Windows Script 5.6"
'     from Microsoft)
' .In the toolbox, double-click CommandButton.
' .Double-click Command1 to open the Code window.
' .Paste the code above into the Command1_Click event handler:
'-----
 
 
 
 
Feedback
ShubhamGupta:: Saved my day!Wed, 29 May 2013 11:36PM
::  Thu, 30 May 2013 12:02AM
Astarte:: Awesome, just awesome!Thu, 30 May 2013 12:03AM
David Dawkins:: Excellent tool, where's the donate link? thank-you !!!Thu, 30 May 2013 02:58PM
:: not badThu, 30 May 2013 10:19PM
::  Fri, 31 May 2013 04:02AM
::  Fri, 31 May 2013 03:12PM
'""': '::  Fri, 31 May 2013 03:23PM
Maybemedic:: Great work. Saved time many times over for me..Fri, 31 May 2013 07:47PM
Scott:: WHATSun, 2 Jun 2013 07:39AM
:: Very cool. Thanx!Sun, 2 Jun 2013 10:13AM
Chinche:: I love you.Mon, 3 Jun 2013 03:41AM
baldo:: I don't get how it worls...Mon, 3 Jun 2013 10:49AM
Fasil:: Awesome..................................................Mon, 3 Jun 2013 11:01AM
:: aweosme3Mon, 3 Jun 2013 12:07PM
d3l:: Nice!Mon, 3 Jun 2013 01:58PM
::  Mon, 3 Jun 2013 02:39PM
Drasive:: This is confusing as hellMon, 3 Jun 2013 02:40PM
hora:: perfecto como lo amoMon, 3 Jun 2013 06:32PM
Marcus:: I'd like an option to search on multiple line input (textarea). Thanks!Sat, 8 Jun 2013 09:30AM
Alan:: good job manSun, 9 Jun 2013 03:55PM
:: alert('s')Mon, 10 Jun 2013 03:53AM
:: Awesome jobMon, 10 Jun 2013 11:16AM
:: This is regex heaven! good stuffMon, 10 Jun 2013 02:53PM
:: How can I limit the length of the digits or string?Tue, 11 Jun 2013 12:44PM
:: \d{#} replace '#' with how many digits you want to match.Tue, 11 Jun 2013 09:42PM
Ørez:: So helpful, thank you!Wed, 12 Jun 2013 05:47AM
sivy:: Great tool !! Thanx!Wed, 12 Jun 2013 03:48PM
:: My eyes.....Wed, 12 Jun 2013 09:15PM
Patric:: WehThu, 13 Jun 2013 04:41AM
easyCoder:: easy codingThu, 13 Jun 2013 12:11PM
martin:: but now what is the regex?what do i put between ^ and "Thu, 13 Jun 2013 12:13PM
Kosheyaka:: ÀWÅSÎÌÅ COMßADE!Thu, 13 Jun 2013 02:29PM
edgaroto:: estos comentarios... como q no cuadran!Thu, 13 Jun 2013 03:00PM
:: thanks, doggThu, 13 Jun 2013 09:32PM
Manivannan:: I love It........Fri, 14 Jun 2013 11:41AM
Àíäðåé Âèêòîðîâè÷::  Fri, 14 Jun 2013 08:07PM
Tecnowilliam:: Great web page and helpful... Thank youFri, 14 Jun 2013 08:57PM
Àíäðåé Âèêòîðîâè÷::  Mon, 17 Jun 2013 09:52AM
:: aaaTue, 18 Jun 2013 07:30AM
::  Wed, 19 Jun 2013 01:47AM
:: abcdefghijklmnñopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVXYZ Wed, 19 Jun 2013 01:49AM
Gobbler:: This is awesome; saved me from much headache.Wed, 19 Jun 2013 06:12PM
::  Wed, 19 Jun 2013 11:37PM
 
  home     faq              ©2006 mark james ennis