in reply to Regexp and metacharacters
use strict; use warnings; while (<DATA>) { chomp; s/^['"]+|['"]+$//g; # Remove starting and ending quotes s/(['"{}])/\\$1/g; # Escape appropriate characters print "$_\n"; } __DATA__ "text with quotes" If it ain't broke, don't fix it. We all love {curly brackets}
However, you haven't defined what you mean by "metacharacters" or why you're trying to do this exactly, so I can't really supply a comprehensive solution. The "why" is especially important, since what people are asking for often isn't what's actually needed.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regexp and metacharacters
by Largins (Acolyte) on Dec 27, 2011 at 01:17 UTC |