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
day1
int1
.
c .
1
c 1
d1
day1
int1
.
c .
1
c 1
d1
day1
int1
.
c .
1
c 1
d1
day1
int1
float1.1
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
int16
/
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
int2009
unixpath/Mar/2009
ddmmmyyyy
:
c :
1
c 1
d1
3
c 3
d3
day13
int13
:
c :
1
c 1
d1
4
c 4
d4
day14
int14
:
c :
1
c 1
d1
5
c 5
d5
day15
int15
_
c _
ws_
-
c -
0
c 0
d0
8
c 8
d8
0
c 0
d0
0
c 0
d0
day00
int0800
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
int1
.
c .
0
c 0
d0
day0
int0
float1.0
unixpath
"
c "
string"GET_/gibbs.gif_HTTP/1.0"
_
c _
ws_
2
c 2
d2
0
c 0
d0
0
c 0
d0
day00
int200
_
c _
ws_
5
c 5
d5
6
c 6
d6
4
c 4
d4
8
c 8
d8
day8
int5648
< 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=1.1.1.1%20-%20bob%20[16/Mar/2009:13:14:15%20-0800]%20%22GET%20/gibbs.gif%20HTTP/1.0%22%20200%205648&8&25&3&16 -->

<html>
  <body>
    <script language=javascript>
      var txt='1.1.1.1 - 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='(?:\\/[\\w\\.\\-]+)+';	// Uninteresting: unixpath
      var re8='.*?';	// Non-greedy match on filler
      var re9='((?:\\/[\\w\\.\\-]+)+)';	// Unix Path 1

      var p = new RegExp(re1+re2+re3+re4+re5+re6+re7+re8+re9,["i"]);
      var m = p.exec(txt);
      if (m != null)
      {
          var ipaddress1=m[1];
          var word1=m[2];
          var ddmmmyyyy1=m[3];
          var unixpath1=m[4];
          document.write("("+ipaddress1.replace(/</,"&lt;")+")"+"("+word1.replace(/</,"&lt;")+")"+"("+ddmmmyyyy1.replace(/</,"&lt;")+")"+"("+unixpath1.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
Ancie:: Awesome.... thanks a lotThu, 26 Jun 2014 10:13AM
Rahul K:: This Site Rocks For Regular Expression Help!!!Thu, 26 Jun 2014 03:42PM
jhonny :: GraciasFri, 27 Jun 2014 08:39PM
davy:: Fantastic as always - work of geniusSat, 28 Jun 2014 10:17AM
:: Awesome toolSun, 29 Jun 2014 06:02PM
hardshit:: really useful allready used it 5 times in my scriptsWed, 2 Jul 2014 06:44AM
ScarEngineer:: Very cool thing! Thank you!Wed, 2 Jul 2014 01:07PM
中国:: goodWed, 2 Jul 2014 04:41PM
pulpster:: Great tool / nice idea Wed, 2 Jul 2014 07:31PM
:: Cool tool! Will be better if support vimscript and unicode characterWed, 2 Jul 2014 07:49PM
milos:: I'm missing the one for BASHThu, 3 Jul 2014 03:19PM
:: ultimate life saver at work!Thu, 3 Jul 2014 04:42PM
好:: 中国网友Fri, 4 Jul 2014 03:22AM
#Love:: Many Wow!Fri, 4 Jul 2014 03:23PM
:: categories: jekyll update ---Fri, 4 Jul 2014 08:05PM
china:: goodMon, 7 Jul 2014 04:56AM
jhtzdsjz:: drJZwlYrMon, 7 Jul 2014 09:29AM
zqkalcb:: gvDFteqeOEOMgohrvUJMon, 7 Jul 2014 10:07AM
Syst鑝e test:: Syst鑝e testMon, 7 Jul 2014 12:50PM
:: From India with loveTue, 8 Jul 2014 12:01PM
:: From India with loveTue, 8 Jul 2014 01:41PM
::  Wed, 9 Jul 2014 02:18AM
::  Wed, 9 Jul 2014 02:45AM
china:: Simply don't understand -- 根本看不懂啊 ---Wed, 9 Jul 2014 06:19AM
:: loved itWed, 9 Jul 2014 09:42AM
n1nja:: awesome!Wed, 9 Jul 2014 01:08PM
:: 18Wed, 9 Jul 2014 02:40PM
:: really cool site) Thank you for it!Wed, 9 Jul 2014 08:50PM
c++::  Thu, 10 Jul 2014 07:00AM
-:: utdv fvdf fryThu, 10 Jul 2014 08:41AM
::  Thu, 10 Jul 2014 10:59AM
xz:: zxzxzxzxcxcxcxThu, 10 Jul 2014 11:50AM
:: ok........Thu, 10 Jul 2014 11:50AM
::  Thu, 10 Jul 2014 01:09PM
::  Thu, 10 Jul 2014 01:10PM
::  Thu, 10 Jul 2014 02:11PM
::  Thu, 10 Jul 2014 08:04PM
vv:: vvvFri, 11 Jul 2014 06:26AM
::  Fri, 11 Jul 2014 06:33AM
::  Fri, 11 Jul 2014 12:01PM
china::  Fri, 11 Jul 2014 02:48PM
::  Sat, 12 Jul 2014 02:26PM
Unixbobo:: Great handy toolSat, 12 Jul 2014 02:27PM
dk:: Very niceSat, 12 Jul 2014 04:56PM
 
  home     faq              ©2006 mark james ennis