Regex Recipe
You want to get back the complete word that has matched your search string.
e.g. fri → frische, as → asdf, fi → Fische, mei → meistens ...
#!/usr/bin/perl -w
use strict;
my $str = 'Fischer Fritz fischt meistens frische asdf oder foo Fische';
my $IN = $ARGV[0] || '';
if ($str =~ /.*\b(.*$IN.*?)\b.*/i) {
print "$1\n";
}
See also:
-
Perl Regex Recipes








- Perl Reference
Common needed regular expressions.
infocopter.com/perl/regex-recipes.html
-
regexBuddy.com/perl.html - Perl Software
Easily Use Regular Expressions in Your Perl Scripts
regexbuddy.com/perl.html