in reply to string matching

@BrowserUK: you fergot some enclosing *

Another similar, but different way:
#!/usr/bin/perl -w use strict; while (<DATA>) { $_ =~ /(The seller has the following \*fruit\* types: )\(?([a-z ,* +]+)\)?\./; my ($const, $rep) = ($1, $2); $rep =~ s/\s?\*\s?/#/g; $rep =~ s/,? and/and/; print "$const*($rep)*.\n"; }
Same input, same output (but with those extra *)