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
c 2
2
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&-6

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

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

    String re1=".*?";	// Non-greedy match on filler
    String re2="(2)";	// Any Single Digit 1
    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 d1=m.get_Groups().get_Item(1).toString();
        String int1=m.get_Groups().get_Item(2).toString();
        System.Console.Write("("+d1.toString()+")"+"("+int1.toString()+")"+"\n");
    }
    System.Console.Read();
  }
}

//-----
// Paste the code into a new Console Application
//-----
 
 
 
 
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 !!!Thu, 30 May 2013 02:58PM
:: not badThu, 30 May 2013 10:19PM
::  Fri, 31 May 2013 04:02AM
::  Fri, 31 May 2013 03:12PM
'""': '::  Fri, 31 May 2013 03:23PM
Maybemedic:: Great work. Saved time many times over for me..Fri, 31 May 2013 07:47PM
Scott:: WHATSun, 2 Jun 2013 07:39AM
:: Very cool. Thanx!Sun, 2 Jun 2013 10:13AM
Chinche:: I love you.Mon, 3 Jun 2013 03:41AM
baldo:: I don't get how it worls...Mon, 3 Jun 2013 10:49AM
Fasil:: Awesome..................................................Mon, 3 Jun 2013 11:01AM
:: aweosme3Mon, 3 Jun 2013 12:07PM
d3l:: Nice!Mon, 3 Jun 2013 01:58PM
::  Mon, 3 Jun 2013 02:39PM
Drasive:: This is confusing as hellMon, 3 Jun 2013 02:40PM
hora:: perfecto como lo amoMon, 3 Jun 2013 06:32PM
Marcus:: I'd like an option to search on multiple line input (textarea). Thanks!Sat, 8 Jun 2013 09:30AM
Alan:: good job manSun, 9 Jun 2013 03:55PM
:: alert('s')Mon, 10 Jun 2013 03:53AM
:: Awesome jobMon, 10 Jun 2013 11:16AM
:: This is regex heaven! good stuffMon, 10 Jun 2013 02:53PM
:: How can I limit the length of the digits or string?Tue, 11 Jun 2013 12:44PM
:: \d{#} replace '#' with how many digits you want to match.Tue, 11 Jun 2013 09:42PM
Ørez:: So helpful, thank you!Wed, 12 Jun 2013 05:47AM
sivy:: Great tool !! Thanx!Wed, 12 Jun 2013 03:48PM
:: My eyes.....Wed, 12 Jun 2013 09:15PM
Patric:: WehThu, 13 Jun 2013 04:41AM
easyCoder:: easy codingThu, 13 Jun 2013 12:11PM
martin:: but now what is the regex?what do i put between ^ and "Thu, 13 Jun 2013 12:13PM
Kosheyaka:: ÀWÅSÎÌÅ COMßADE!Thu, 13 Jun 2013 02:29PM
edgaroto:: estos comentarios... como q no cuadran!Thu, 13 Jun 2013 03:00PM
:: thanks, doggThu, 13 Jun 2013 09:32PM
Manivannan:: I love It........Fri, 14 Jun 2013 11:41AM
Àíäðåé Âèêòîðîâè÷::  Fri, 14 Jun 2013 08:07PM
Tecnowilliam:: Great web page and helpful... Thank youFri, 14 Jun 2013 08:57PM
Àíäðåé Âèêòîðîâè÷::  Mon, 17 Jun 2013 09:52AM
:: aaaTue, 18 Jun 2013 07:30AM
::  Wed, 19 Jun 2013 01:47AM
:: abcdefghijklmnñopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVXYZ Wed, 19 Jun 2013 01:49AM
Gobbler:: This is awesome; saved me from much headache.Wed, 19 Jun 2013 06:12PM
::  Wed, 19 Jun 2013 11:37PM
 
  home     faq              ©2006 mark james ennis