At 14:49 Uhr +0100 29.01.2003, Eelco Alosery wrote:
From a string I want to filter out what is between [ and ]Try something like this:
$word must now contain what stands there.
Bur there is no telling where the [ and the ] stands so it must delete al what is in front of [ and what is after ]
#!perl -w
$string = 'This is [a test] string';
$string =~ m/.*\[(.*)\].*/;
$word = $1;
print "word= -$word- \n";
__END__
Also see the m/PATTERN/cgimosx matching operator in perlop.pod and read the Perl regular expression manpage perlre.pod.
HTH,
Thomas