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
F
c F
wF
u
c u
wu
l
c l
wl
l
c l
wl
m
c m
wm
e
c e
we
t
c t
wt
a
c a
wa
l
c l
wl
usstateal
varFullmetal
wordFullmetal
_
c _
ws_
A
c A
wA
l
c l
wl
c
c c
wc
h
c h
wh
e
c e
we
m
c m
wm
i
c i
wi
s
c s
ws
t
c t
wt
varAlchemist
wordAlchemist
_
c _
ws_
S
c S
wS
h
c h
wh
i
c i
wi
n
c n
wn
s
c s
ws
e
c e
we
t
c t
wt
s
c s
ws
u
c u
wu
varShinsetsu
wordShinsetsu
_
c _
ws_
-
c -
_
c _
ws_
3
c 3
d3
0
c 0
d0
day30
int30
_
c _
ws_
[
c [
1
c 1
d1
0
c 0
d0
day10
int10
A
c A
wA
8
c 8
d8
7
c 7
d7
9
c 9
d9
day9
int879
D
c D
wD
9
c 9
d9
day9
int9
varA879D9
alphanumA879D9
]
c ]
sbraces
< Source String
What to click?  extract any integer in this position
extract this integer (2006) in this position
 
3Perl 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 
 
#!/usr/bin/perl

# URL that generated this code:
# http://txt2re.com/index.php3?s=Fullmetal%20Alchemist%20Shinsetsu%20-%2030%20%5B10A879D9%5D&1

$txt='Fullmetal Alchemist Shinsetsu - 30 [10A879D9]';

$re1='.*?';	# Non-greedy match on filler
$re2='(\\[.*?\\])';	# Square Braces 1

$re=$re1.$re2;
if ($txt =~ m/$re/is)
{
    $sbraces1=$1;
    print "($sbraces1) \n";
}

#-----
# Paste the code into a new perl file. Then in Unix:
# $ perl x.pl 
#-----
 
 
  home     faq              ©2006 mark james ennis