// URL that generated this code:
// http://txt2re.com/index-java.php3?s=42%2043&2&-13&10
import java.util.regex.*;
class Main
{
public static void main(String[] args)
{
String txt="42 43";
String re1="(4)"; // Any Single Character 1
String re2=".*?"; // Non-greedy match on filler
String re3="."; // Uninteresting: c
String re4=".*?"; // Non-greedy match on filler
String re5="(.)"; // Any Single Character 2
String re6="(\\d+)"; // Integer Number 1
Pattern p = Pattern.compile(re1+re2+re3+re4+re5+re6,Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
Matcher m = p.matcher(txt);
if (m.find())
{
String c1=m.group(1);
String c2=m.group(2);
String int1=m.group(3);
System.out.print("("+c1.toString()+")"+"("+c2.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
ShubhamGupta::
Saved my day!
Wed, 29 May 2013 11:36PM
::
Thu, 30 May 2013 12:02AM
Astarte::
Awesome, just awesome!
Thu, 30 May 2013 12:03AM
David Dawkins::
Excellent tool, where's the donate link? thank-you !!!