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
c
c c
wc
l
c l
wl
a
c a
wa
s
c s
ws
s
c s
ws
varclass
wordclass
=
c =
"
c "
f
c f
wf
b
c b
wb
varfb
wordfb
_
c _
ws_
s
c s
ws
1
c 1
d1
0
c 0
d0
day10
int10
vars10
alphanums10
"
c "
string"fb_s10"
_
c _
ws_
t
c t
wt
i
c i
wi
t
c t
wt
l
c l
wl
e
c e
we
vartitle
wordtitle
=
c =
"
c "
"
c "
string
>
c >
< Source String
What to click?  extract any integer in this position
extract this integer (2006) in this position
 
3C# 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-csharp.php3?s=class=%22fb%20s10%22%20title=%22%22%3E&8

using System;
using System.Text.RegularExpressions;

namespace ConsoleApplication1
{
  class Program
  {
    static void Main(string[] args)
    {
      string txt="class=\"fb s10\" title=\"\">";

      string re1=".*?";	// Non-greedy match on filler
      string re2="\".*?\"";	// Uninteresting: string
      string re3=".*?";	// Non-greedy match on filler
      string re4="(\".*?\")";	// Double Quote String 1

      Regex r = new Regex(re1+re2+re3+re4,RegexOptions.IgnoreCase|RegexOptions.Singleline);
      Match m = r.Match(txt);
      if (m.Success)
      {
            String string1=m.Groups[1].ToString();
            Console.Write("("+string1.ToString()+")"+"\n");
      }
      Console.ReadLine();
    }
  }
}

//-----
// Paste the code into a new Console Application
//-----
 
 
  home     faq              ©2006 mark james ennis