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
$
 $
v
c v
wv
a
c a
wa
r
c r
wr
i
c i
wi
a
c a
wa
b
c b
wb
l
c l
wl
e
c e
we
varvariable
word
$
 $
1
c 1
d1
2
c 2
d2
3
c 3
d3
day23
123
dollars$123
< 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://txt2re.com/index-php.php3?s=%24variable%24123&-17&1&-18&-4

  $txt='$variable$123';

  $re1='(\\$)';	# Any Single Character 1
  $re2='((?:[a-z][a-z]+))';	# Word 1
  $re3='(\\$)';	# Any Single Character 2
  $re4='(123)';	# Integer Number 1

  if ($c=preg_match_all ("/".$re1.$re2.$re3.$re4."/is", $txt, $matches))
  {
      $c1=$matches[1][0];
      $word1=$matches[2][0];
      $c2=$matches[3][0];
      $int1=$matches[4][0];
      print "($c1) ($word1) ($c2) ($int1) \n";
  }

  #-----
  # Paste the code into a new php file. Then in Unix:
  # $ php x.php 
  #-----
?>
 
 
  home     faq              ©2006 mark james ennis