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
8
c 8
d
8
c 8
d
8
c 8
d
day8
int888
-
c -
8
c 8
d
8
c 8
d8
8
c 8
d
day8
int888
signed_int-888
-
c -
8
c 8
d
8
c 8
d
8
c 8
d
8
c 8
d
day8
int8888
signed_int-8888
< 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=888-888-8888&9&10&11&12&14&15&17&18&16 -->

<html>
  <body>
    <script language=javascript>
      var txt='888-888-8888';

      var re1='(\\d)';	// Any Single Digit 1
      var re2='(\\d)';	// Any Single Digit 2
      var re3='(\\d)';	// Any Single Digit 3
      var re4='.*?';	// Non-greedy match on filler
      var re5='(\\d)';	// Any Single Digit 4
      var re6='.*?';	// Non-greedy match on filler
      var re7='\\d';	// Uninteresting: d
      var re8='.*?';	// Non-greedy match on filler
      var re9='(\\d)';	// Any Single Digit 5
      var re10='.*?';	// Non-greedy match on filler
      var re11='(\\d)';	// Any Single Digit 6
      var re12='(\\d)';	// Any Single Digit 7
      var re13='(\\d)';	// Any Single Digit 8
      var re14='(\\d)';	// Any Single Digit 9

      var p = new RegExp(re1+re2+re3+re4+re5+re6+re7+re8+re9+re10+re11+re12+re13+re14,["i"]);
      var m = p.exec(txt);
      if (m != null)
      {
          var d1=m[1];
          var d2=m[2];
          var d3=m[3];
          var d4=m[4];
          var d5=m[5];
          var d6=m[6];
          var d7=m[7];
          var d8=m[8];
          var d9=m[9];
          document.write("("+d1.replace(/</,"&lt;")+")"+"("+d2.replace(/</,"&lt;")+")"+"("+d3.replace(/</,"&lt;")+")"+"("+d4.replace(/</,"&lt;")+")"+"("+d5.replace(/</,"&lt;")+")"+"("+d6.replace(/</,"&lt;")+")"+"("+d7.replace(/</,"&lt;")+")"+"("+d8.replace(/</,"&lt;")+")"+"("+d9.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 -->
<!-- -->
 
 
  home     faq              ©2006 mark james ennis