You're trying to do it with a character class, which doesn't act as you want. Try matching all text up to what you capture and substituting just the capture.
$text =~ s/.*?\b(book|cover)\b/$1/g; That will likely leave text to be removed from the end of the string. I'll leave eliminating that as an exercise.After Compline,
Zaxo
In reply to Re: regexp everything except
by Zaxo
in thread regexp everything except
by Murcia
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |