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
Diogo Areia:: ONCE AGAIN THANKS !!!!Tue, 29 Jun 2010 03:29PM
Paco Aragon:: AWESOME TOOL!!! thxTue, 29 Jun 2010 08:19PM
Cadari:: bem originalWed, 30 Jun 2010 12:30AM
Soth:: Pure AwesomenessFri, 2 Jul 2010 03:06PM
lor:: GREAT STUFF!!!Sun, 4 Jul 2010 06:01AM
bullrocks:: great work....Sun, 4 Jul 2010 07:10AM
Brasil:: fucking genius....!!Mon, 5 Jul 2010 11:53AM
You:: Saved my lifeTue, 6 Jul 2010 10:10AM
PampaDelinfierno:: You're bastard!!! Thanks!!!Tue, 6 Jul 2010 11:50PM
myddrn:: Is the code generated by your tool public domain?Wed, 7 Jul 2010 04:18PM
Bio:: Briliant! Thanks dude!Thu, 8 Jul 2010 04:03PM
Jean:: very good, thksThu, 8 Jul 2010 04:43PM
Priyank:: What a wonderful tool for regular expressions Thu, 8 Jul 2010 11:04PM
Amit:: WOW! This is mind blowing! You are a saviour man !Fri, 9 Jul 2010 08:49AM
yan:: your work is very appreciated.Sun, 11 Jul 2010 11:04AM
Govindan:: excellent !!!Sun, 11 Jul 2010 11:44AM
arnold:: Great job! But maybe better using POST instead of GET regarding size limit...Mon, 12 Jul 2010 07:49AM
:: i can't beleave it. it is incredible. thank youTue, 13 Jul 2010 07:27AM
Marolo:: Please Add function for negation - to find string without matches...Tue, 13 Jul 2010 04:18PM
Aygul:: Very good. I need reverse of this one. giving "ab[12]c" returns "ab1c" and "ab2c".Thu, 15 Jul 2010 01:44PM
ac:: Direct to my best bookmarks!!! Incredible tool!!!Fri, 16 Jul 2010 10:30AM
mithikos:: how to domate ?Fri, 16 Jul 2010 05:30PM
mithikos:: donate*Fri, 16 Jul 2010 06:34PM
Ryan:: Awesome!Tue, 20 Jul 2010 09:22AM
:::: cool!!!Tue, 20 Jul 2010 10:59AM
china panda:: geniusTue, 20 Jul 2010 11:30AM
walkerxk:: genius!!!Tue, 20 Jul 2010 11:31AM
GuTi:: genius!!!£¡£¡£¡£¡Tue, 20 Jul 2010 11:37AM
Sartrey:: Unbelievable! Incredible! Impossible! Tue, 20 Jul 2010 12:32PM
ngzk:: this is awesome! thanks man!Tue, 20 Jul 2010 11:10PM
Xiaonei Visitor:: Thanks,it's great!Wed, 21 Jul 2010 08:58AM
³ÌÐòÔ³:: Code Monkey ContingentWed, 21 Jul 2010 04:37PM
CodeHack:: Great tool, Thanks for all your work on thisThu, 22 Jul 2010 02:11AM
___:: var $i = 0; while($i==0){echo "thank you";}Thu, 22 Jul 2010 11:40AM
:: i love you !!Thu, 22 Jul 2010 04:07PM
:: thank you, awesome page!Sun, 25 Jul 2010 02:18AM
adbv829:: Thank you so much, very helpful and smart tool!Sun, 25 Jul 2010 04:59PM
:: thanks!Sun, 25 Jul 2010 08:13PM
li:: how to use ?Mon, 26 Jul 2010 05:44AM
here:: it save my ass, thanks :DMon, 26 Jul 2010 11:22AM
mohican:: awesome!!!!Tue, 27 Jul 2010 04:36PM
wow:: 0.o :DWed, 28 Jul 2010 07:24PM
:: dude.......!Wed, 28 Jul 2010 08:45PM
:: obama no more!!!!!Wed, 28 Jul 2010 10:35PM
 
  home     faq