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 
d4
2
c 
d2
day2
int42
_
c _
ws_
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
 
3J# 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-jsharp.php3?s=42%2043&2&11&13

package ConsoleApplication1;
import System.Text.RegularExpressions.*;

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

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

    Regex r = new Regex(re1+re2+re3+re4,RegexOptions.IgnoreCase|RegexOptions.Singleline);
    Match m = r.Match(txt);
    if (m.get_Success())
    {
        String c1=m.get_Groups().get_Item(1).toString();
        String c2=m.get_Groups().get_Item(2).toString();
        String int1=m.get_Groups().get_Item(3).toString();
        System.Console.Write("("+c1.toString()+")"+"("+c2.toString()+")"+"("+int1.toString()+")"+"\n");
    }
    System.Console.Read();
  }
}

//-----
// Paste the code into a new Console Application
//-----
 
 
 
 
Feedback
:: excellentFri, 5 Sep 2014 03:09PM
:: Muchas gracias por publicar tu trabajo :DFri, 5 Sep 2014 03:37PM
Genesio:: too clever! :-)Fri, 5 Sep 2014 04:12PM
:: It's fucking useful!Sat, 6 Sep 2014 05:11AM
Al:: EhhhhhhMon, 8 Sep 2014 03:48PM
Howl:: Awesome.Tue, 9 Sep 2014 06:19PM
What:: Happened Thu, 11 Sep 2014 09:32AM
in :: Chicago on this day?Thu, 11 Sep 2014 09:33AM
Thank you:: Thank youThu, 11 Sep 2014 10:34AM
I:: Love herThu, 11 Sep 2014 10:34AM
amil:: eman reh siThu, 11 Sep 2014 11:42AM
m:: wow this is sick!Thu, 11 Sep 2014 02:30PM
swagoverflow:: simply the bestFri, 12 Sep 2014 07:01AM
dmitry:: that a cool tool thanks :)!Sat, 13 Sep 2014 09:48PM
:: 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
Geek AK:: ArgentinaaWed, 17 Sep 2014 04:53AM
ET:: Saved my dayWed, 17 Sep 2014 07:37AM
Brazilian Guy:: Don't work for me.Wed, 17 Sep 2014 08:31PM
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
Lawrence:: Amazing tool. Thanks!Tue, 23 Sep 2014 12:19PM
linux_user:: Can you please add support fro C++ using Qt?Tue, 23 Sep 2014 08:01PM
javauser:: how does this work?Thu, 25 Sep 2014 08:32PM
::  Fri, 26 Sep 2014 10:45AM
Pranav:: Amazing! Fri, 26 Sep 2014 01:41PM
::  Fri, 26 Sep 2014 02:00PM
uxzanechvof:: ZvOYnOOIbeLlxfddASat, 27 Sep 2014 12:27PM
Iannos:: Brilliant ideaSat, 27 Sep 2014 01:57PM
Totom3:: Love it, thanks so much :DSun, 28 Sep 2014 04:54AM
'or '1'='1' --'::  Sun, 28 Sep 2014 04:19PM
::  Sun, 28 Sep 2014 08:54PM
asd:: marked as failure correctMon, 29 Sep 2014 11:58AM
 ::::  Mon, 29 Sep 2014 02:04PM
 ::  Mon, 29 Sep 2014 02:04PM
::  Mon, 29 Sep 2014 02:17PM
Universal5:: Thank you! You saved me quite some time and a headache. :-)Mon, 29 Sep 2014 07:27PM
:: thank you!! well done! very usefulTue, 30 Sep 2014 05:05AM
:: Thats great sirTue, 30 Sep 2014 05:57AM
Андрей Викторович::  Tue, 30 Sep 2014 11:54AM
::  Wed, 1 Oct 2014 11:07AM
Ricktza:: Perfect.Wed, 1 Oct 2014 12:03PM
::  Wed, 1 Oct 2014 04:04PM
wfcrrt:: hluUcJsCgqkThu, 2 Oct 2014 12:37AM
 
  home     faq              ©2006 mark james ennis