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
4
c 4
d4
2
 2
d2
day2
int42
_
c _
_
4
c 4
d4
3
c 3
d3
day3
int
< Source String
What to click?  extract any integer in this position
extract this integer (2006) in this position
 
3Java 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-java.php3?s=42%2043&2&-5&-11 

import java.util.regex.*;

class Main
{
  public static void main(String[] args)
  {
    String txt="42 43";

    String re1=".*?";	// Non-greedy match on filler
    String re2="(2)";	// Any Single Character 1
    String re3="( )";	// White Space 1
    String re4="(\\d+)";	// Integer Number 1

    Pattern p = Pattern.compile(re1+re2+re3+re4,Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
    Matcher m = p.matcher(txt);
    if (m.find())
    {
        String c1=m.group(1);
        String ws1=m.group(2);
        String int1=m.group(3);
        System.out.print("("+c1.toString()+")"+"("+ws1.toString()+")"+"("+int1.toString()+")"+"\n");
    }
  }
}

//-----
// This code is for use with Sun's Java VM - see http://java.sun.com/ for downloads. 
//
// Paste the code into a new java application or a file called 'Main.java'
//
// Compile and run in Unix using:
// # javac Main.java 
// # java Main 
//
 
 
 
 
Feedback
swagoverflow:: simply the bestFri, 12 Sep 2014 07:01AM
理漯彘 妈牝铕钼梓::  Fri, 12 Sep 2014 09:40AM
www.baidu.com/link?url=::  Fri, 12 Sep 2014 03:15PM
www.baidu.com/link?url=::  Fri, 12 Sep 2014 03:17PM
www.baidu.com/link?url=::  Fri, 12 Sep 2014 03:18PM
中国:: 不错,到些一游!Sat, 13 Sep 2014 07:44AM
中国:: 不错,到些一游!Sat, 13 Sep 2014 07:44AM
lqlyybctfn:: sVGDWVUHeZJQAcRvHPSat, 13 Sep 2014 09:55AM
::  Sat, 13 Sep 2014 08:29PM
dmitry:: that a cool tool thanks :)!Sat, 13 Sep 2014 09:48PM
:: ");alert("fuck you");Sun, 14 Sep 2014 02:35AM
理漯彘 妈牝铕钼梓::  Sun, 14 Sep 2014 03:30PM
理漯彘 妈牝铕钼梓::  Sun, 14 Sep 2014 07:31PM
oi:: javascript:alert("fix me");Mon, 15 Sep 2014 10:50AM
::  Tue, 16 Sep 2014 05:35AM
:: you guys are fucking losers, piss off with your inject attempts.Tue, 16 Sep 2014 06:47AM
::  Tue, 16 Sep 2014 08:07AM
:: NOT HELPFUL !!!Tue, 16 Sep 2014 08:07AM
:: It compares character by character and does not give any generic result.. so basically REGEX given by u is specific to that particular string..Tue, 16 Sep 2014 08:08AM
::  Tue, 16 Sep 2014 11:25AM
:: @[User:1638|Sushant Dua]​​ Tue, 16 Sep 2014 11:38AM
Geek AK:: ArgentinaaWed, 17 Sep 2014 04:53AM
ET:: Saved my dayWed, 17 Sep 2014 07:37AM
:: javascript:alert("fix me");Wed, 17 Sep 2014 01:04PM
:: javascript:alert("fix me");Wed, 17 Sep 2014 01:05PM
88::  Wed, 17 Sep 2014 02:12PM
Brazilian Guy:: Don't work for me.Wed, 17 Sep 2014 08:31PM
::  javascript:alert("fix me");Thu, 18 Sep 2014 05:07PM
as:: safFri, 19 Sep 2014 04:24AM
:: javascript:alert("fix me");Fri, 19 Sep 2014 07:22AM
::  Fri, 19 Sep 2014 07:22AM
::  Fri, 19 Sep 2014 07:22AM
::  Fri, 19 Sep 2014 07:22AM
::  Fri, 19 Sep 2014 07:22AM
::  Fri, 19 Sep 2014 07:22AM
::  Fri, 19 Sep 2014 07:22AM
::  Fri, 19 Sep 2014 07:22AM
sasasasa::  Fri, 19 Sep 2014 01:16PM
Paul:: Brilliant! Bookmarked. :o)Fri, 19 Sep 2014 04:23PM
MarkyMark:: Please add Powershell as a languageFri, 19 Sep 2014 09:40PM
mo:: works perfectly for javaSat, 20 Sep 2014 01:07PM
::  Sun, 21 Sep 2014 07:12PM
"#?$%&()/(;"#$%;/)Z>>>x:: "#?$%&()/(;"#$%;/)Z>>>xSun, 21 Sep 2014 07:12PM
::  Mon, 22 Sep 2014 03:18AM
 
  home     faq              ©2006 mark james ennis