txt 2 re
        headache relief for programmers :: 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
h
c h
wh
t
c t
wt
t
c t
wt
p
c p
wp
varhttp
wordhttp
:
c :
/
c /
/
c /
w
c w
ww
w
c w
ww
w
c w
ww
varwww
wordwww
.
c .
s
c s
ws
o
c o
wo
m
c m
wm
e
c e
we
t
c t
wt
h
c h
wh
i
c i
wi
n
c n
wn
g
c g
wg
varsomething
wordsomething
.
c .
c
c c
wc
o
c o
wo
m
c m
wm
varcom
wordcom
filewww.something.com
fqdnwww.something.com
unixpath/www.something.com
httpurl
< Source String
What to click?  extract any integer in this position
extract this integer (2006) in this position
 
3PHP 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 
 
<?php
  # URL that generated this code:
  # http://www.txt2re.com/index-php.php3?s=http://www.something.com&1

  $txt='http://www.something.com';

  $re1='((?:http|https)(?::\\/{2}[\\w]+)(?:[\\/|\\.]?)(?:[^\\s"]*))';	# HTTP URL 1

  if ($c=preg_match_all ("/".$re1."/is", $txt, $matches))
  {
      $httpurl1=$matches[1][0];
      print "($httpurl1) \n";
  }

  #-----
  # Paste the code into a new php file. Then in Unix:
  # $ php x.php 
  #-----
?>
plain text version of code
 
 
 
 
Feedback
:: This is not a good tool if you aren't already a regex guru.Fri, 15 Jan 2010 06:28PM
B-rad:: Way to save me a huge amount of work!Fri, 15 Jan 2010 07:05PM
heinz:: what a great tool. to make it even better please add a convertion to moderewriteMon, 18 Jan 2010 08:14PM
hank detweiler:: awesome!Tue, 19 Jan 2010 10:50PM
:: you saved me! :)Thu, 21 Jan 2010 01:15PM
roelandp:: classic , epic, dopeThu, 21 Jan 2010 04:02PM
Tony:: Very coolFri, 22 Jan 2010 02:44PM
Ally:: Best regex tool ive usedFri, 22 Jan 2010 03:05PM
Colin:: Very cool!!!!!Fri, 22 Jan 2010 09:50PM
def:: I was impressed when I saw the tool, amused when I read the faq, and now my eyes will stop bleeding whilst writing regexes.Sat, 23 Jan 2010 11:34AM
ShaZ:: This really works?Mon, 25 Jan 2010 12:02AM
:: I don't get it. How do I use this to see the regexp I need to place in my code?Mon, 25 Jan 2010 04:30AM
Seriously:: I don't get your generatorTue, 26 Jan 2010 02:21AM
Triqui:: Really great mate!!!Tue, 26 Jan 2010 08:26AM
Triqui:: when did you launched this tool?Tue, 26 Jan 2010 08:27AM
weston:: i use this every day. thank you!Tue, 26 Jan 2010 10:47PM
Tim:: Cool, gonna use this tool much moreThu, 28 Jan 2010 01:10PM
nhakem:: ip v4 not correct Thu, 28 Jan 2010 04:22PM
Jako:: I will worship you.Fri, 29 Jan 2010 03:53PM
shark:: thanks! from franceFri, 29 Jan 2010 03:55PM
lululu:: Lululu, ich mag Äpfel mehr als Du, lululu..Fri, 29 Jan 2010 11:25PM
jake:: how about adding support for linux shell utility GREP ?Sat, 30 Jan 2010 06:32PM
Randy:: I'm with Jake, this is a great tool but would be even better with the ability to use grep style regexesSun, 31 Jan 2010 02:19AM
thanks:: this helped me figure out what I was doing wrongMon, 1 Feb 2010 12:47AM
grep:: I agree with 'jake', grep support would be pretty useful even to non-programmers!Mon, 1 Feb 2010 09:18AM
grep:: ...and forgot to mention: thanks! ;)Mon, 1 Feb 2010 08:51PM
margot:: thxTue, 2 Feb 2010 10:58AM
Denny:: i wonder if i can see your code to build this awesome regex generator since i need some part of it for my assignmentWed, 3 Feb 2010 05:50PM
:: lòlWed, 3 Feb 2010 07:06PM
djoseph:: Nice tool, saved a lot of hours spent on trial and error. thanks.Wed, 3 Feb 2010 07:22PM
kartins:: great job!!!Thu, 4 Feb 2010 08:13AM
chris:: superThu, 4 Feb 2010 11:51AM
:: Does not give me the regular exp to match 01-[any two digit number-].*-2010 from 'kdslfkdsfkljds01-02-03-04-05-06-2010asdasd01-02-sdfsdf-2010sadasdThu, 4 Feb 2010 11:10PM
::  Fri, 5 Feb 2010 06:01AM
Michael:: Very handy. :)Fri, 5 Feb 2010 05:48PM
:: paypal paypal paypal paypal paypal paypal paypal paypal paypal paypal paypal paypal paypal paypal paypal paypal paypal paypal paypal paypal paypal paypal paypal paypal Fri, 5 Feb 2010 07:19PM
p.s.:: what's your goddamn paypal if it ain't your email address? you could be rich!Fri, 5 Feb 2010 07:20PM
no:: not a good tool for real programmer that have more than simple straight forward expressions to matchSat, 6 Feb 2010 12:49PM
someone:: So it should do for you. :)Sat, 6 Feb 2010 02:48PM
:: coolSun, 7 Feb 2010 12:09AM
sddsds:: dsssdSun, 7 Feb 2010 12:46AM
sdcsdc:: sdcsdcsdcsdc+Sun, 7 Feb 2010 12:16PM
WAHWAHWAHWAH:: NiceMon, 8 Feb 2010 06:09AM
blacklemon67:: amazingMon, 8 Feb 2010 09:18PM
 
  home     faq