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
1
c 1
d1
9
c 9
d9
2
c 2
d2
day2
.
c .
1
c 1
d1
6
c 6
d6
8
c 8
d8
day8
.
c .
1
c 1
d1
0
c 0
d0
day10
.
c .
1
c 1
d1
1
c 1
d1
day11
float10.11
ddmmyy8.10.11
yymmdd68.10.11
ipaddress
_
c _
ws_
-
c -
_
c _
ws_
b
c b
wb
o
c o
wo
b
c b
wb
varbob
word
_
c _
ws_
[
c [
1
c 1
d1
6
c 6
d6
day16
/
c /
M
c M
wM
a
c a
wa
r
c r
wr
usstatear
varMar
wordMar
monthMar
/
c /
2
c 2
d2
0
c 0
d0
0
c 0
d0
9
c 9
d9
day09
year2009
unixpath/Mar/2009
ddmmmyyyy
:
c :
1
c 1
d1
3
c 3
d3
day13
:
c :
1
c 1
d1
4
c 4
d4
day14
:
c :
1
c 1
d1
5
c 5
d5
day15
_
c _
ws_
-
c -
0
c 0
d0
8
c 8
d8
0
c 0
d0
0
c 0
d0
day00
signed_int-0800
]
c ]
sbraces[16/Mar/2009:13:14:15_-0800]
_
c _
ws_
"
c "
G
c G
wG
E
c E
wE
T
c T
wT
varGET
wordGET
_
c _
ws_
/
c /
g
c g
wg
i
c i
wi
b
c b
wb
b
c b
wb
s
c s
ws
vargibbs
wordgibbs
.
c .
g
c g
wg
i
c i
wi
f
c f
wf
vargif
wordgif
filegibbs.gif
fqdngibbs.gif
unixpath/gibbs.gif
_
c _
ws_
H
c H
wH
T
c T
wT
T
c T
wT
P
c P
wP
varHTTP
wordHTTP
/
c /
1
c 1
d1
day1
.
c .
0
c 0
d0
day0
float1.0
unixpath/1.0
"
c "
string"GET_/gibbs.gif_HTTP/1.0"
_
c _
ws_
2
c 2
d2
0
c 0
d0
0
c 0
d0
day00
_
c _
ws_
5
c 5
d
6
c 6
d
4
c 4
d
8
c 8
d
day8
< Source String
What to click?  extract any integer in this position
extract this integer (2006) in this position
 
3Javascript 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-javascript.php3?s=192.168.10.11%20-%20bob%20[16/Mar/2009:13:14:15%20-0800]%20%22GET%20/gibbs.gif%20HTTP/1.0%22%20200%205648&3&23&4&100&103&98&106 -->

<html>
  <body>
    <script language=javascript>
      var txt='192.168.10.11 - bob [16/Mar/2009:13:14:15 -0800] "GET /gibbs.gif HTTP/1.0" 200 5648';

      var re1='((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(?![\\d])';	// IPv4 IP Address 1
      var re2='.*?';	// Non-greedy match on filler
      var re3='((?:[a-z][a-z]+))';	// Word 1
      var re4='.*?';	// Non-greedy match on filler
      var re5='((?:(?:[0-2]?\\d{1})|(?:[3][01]{1}))[-:\\/.](?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Sept|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)[-:\\/.](?:(?:[1]{1}\\d{1}\\d{1}\\d{1})|(?:[2]{1}\\d{3})))(?![\\d])';	// DDMMMYYYY 1
      var re6='.*?';	// Non-greedy match on filler
      var re7='\\d';	// Uninteresting: d
      var re8='.*?';	// Non-greedy match on filler
      var re9='\\d';	// Uninteresting: d
      var re10='.*?';	// Non-greedy match on filler
      var re11='\\d';	// Uninteresting: d
      var re12='.*?';	// Non-greedy match on filler
      var re13='\\d';	// Uninteresting: d
      var re14='.*?';	// Non-greedy match on filler
      var re15='\\d';	// Uninteresting: d
      var re16='.*?';	// Non-greedy match on filler
      var re17='\\d';	// Uninteresting: d
      var re18='.*?';	// Non-greedy match on filler
      var re19='\\d';	// Uninteresting: d
      var re20='.*?';	// Non-greedy match on filler
      var re21='\\d';	// Uninteresting: d
      var re22='.*?';	// Non-greedy match on filler
      var re23='\\d';	// Uninteresting: d
      var re24='.*?';	// Non-greedy match on filler
      var re25='\\d';	// Uninteresting: d
      var re26='.*?';	// Non-greedy match on filler
      var re27='\\d';	// Uninteresting: d
      var re28='.*?';	// Non-greedy match on filler
      var re29='\\d';	// Uninteresting: d
      var re30='.*?';	// Non-greedy match on filler
      var re31='\\d';	// Uninteresting: d
      var re32='.*?';	// Non-greedy match on filler
      var re33='\\d';	// Uninteresting: d
      var re34='.*?';	// Non-greedy match on filler
      var re35='\\d';	// Uninteresting: d
      var re36='.*?';	// Non-greedy match on filler
      var re37='(\\d)';	// Any Single Digit 1
      var re38='(\\d)';	// Any Single Digit 2
      var re39='(\\d)';	// Any Single Digit 3
      var re40='(\\d)';	// Any Single Digit 4

      var p = new RegExp(re1+re2+re3+re4+re5+re6+re7+re8+re9+re10+re11+re12+re13+re14+re15+re16+re17+re18+re19+re20+re21+re22+re23+re24+re25+re26+re27+re28+re29+re30+re31+re32+re33+re34+re35+re36+re37+re38+re39+re40,["i"]);
      var m = p.exec(txt);
      if (m != null)
      {
          var ipaddress1=m[1];
          var word1=m[2];
          var ddmmmyyyy1=m[3];
          var d1=m[4];
          var d2=m[5];
          var d3=m[6];
          var d4=m[7];
          document.write("("+ipaddress1.replace(/</,"&lt;")+")"+"("+word1.replace(/</,"&lt;")+")"+"("+ddmmmyyyy1.replace(/</,"&lt;")+")"+"("+d1.replace(/</,"&lt;")+")"+"("+d2.replace(/</,"&lt;")+")"+"("+d3.replace(/</,"&lt;")+")"+"("+d4.replace(/</,"&lt;")+")"+"\n");
      }
    </script>
  </body>
</html>

<!-- -->
<!-- Paste the code into a file that can be served by your web server -->
<!-- or into a local file that can be read by your browser -->
<!-- -->
 
 
 
 
Feedback
xiaolanmao:: save my life!Wed, 16 Jul 2014 05:46AM
sinbad:: very good But it does not support simplified ChineseWed, 16 Jul 2014 08:28AM
::  Wed, 16 Jul 2014 09:35AM
:: DROP TABLE *;Wed, 16 Jul 2014 12:02PM
::  Wed, 16 Jul 2014 01:29PM
:: you are a genius!Wed, 16 Jul 2014 01:42PM
::  Wed, 16 Jul 2014 06:05PM
Dude:: I mean, really awesome work! Thanks so much!Wed, 16 Jul 2014 07:45PM
::  Wed, 16 Jul 2014 10:12PM
:: ppWed, 16 Jul 2014 10:13PM
:: ppWed, 16 Jul 2014 10:13PM
:: ppWed, 16 Jul 2014 10:13PM
:: ppWed, 16 Jul 2014 10:13PM
::  Thu, 17 Jul 2014 10:02AM
nope:: :::Thu, 17 Jul 2014 10:02AM
::  Thu, 17 Jul 2014 10:03AM
:: awesome tool :)Thu, 17 Jul 2014 10:37AM
:: amazinThu, 17 Jul 2014 09:30PM
::  Thu, 17 Jul 2014 10:23PM
:: yoFri, 18 Jul 2014 07:57AM
::  Fri, 18 Jul 2014 09:11AM
::  Fri, 18 Jul 2014 10:27AM
::  Fri, 18 Jul 2014 03:12PM
binesh:: superbSat, 19 Jul 2014 02:07PM
::  Mon, 21 Jul 2014 12:39PM
::  Mon, 21 Jul 2014 02:32PM
ˡˡ:: Mon, 21 Jul 2014 03:02PM
::  Mon, 21 Jul 2014 10:29PM
xss:: DROP TABLE *Tue, 22 Jul 2014 12:17AM
:: lol fail ^^^Tue, 22 Jul 2014 01:45AM
::  Tue, 22 Jul 2014 02:03AM
::  Tue, 22 Jul 2014 04:35AM
::  Tue, 22 Jul 2014 04:38AM
:: DROP TABLE *Tue, 22 Jul 2014 08:23AM
:: DROP TABLES *;Tue, 22 Jul 2014 08:23AM
:: EXEC sp_MSforeachtable @command1 = "DROP TABLE ?"Tue, 22 Jul 2014 08:24AM
:: PRAGMA writable_schema = 1; delete from sqlite_master where type = 'table'; PRAGMA writable_schema = 0;Tue, 22 Jul 2014 08:25AM
:: VACUUM;Tue, 22 Jul 2014 08:25AM
:: PRAGMA INTEGRITY_CHECK;Tue, 22 Jul 2014 08:25AM
:: rm db/development.sqlite3Tue, 22 Jul 2014 08:26AM
:: rm db/*Tue, 22 Jul 2014 08:26AM
:: DROP TABLE *; --Tue, 22 Jul 2014 08:41AM
:: x'; DROP TABLE *; --Tue, 22 Jul 2014 08:42AM
::  Tue, 22 Jul 2014 01:20PM
 
  home     faq              ©2006 mark james ennis