CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions: Re: [dendro] Need help with small but tricky job: Edit Log



miller
User

Apr 22, 2011, 9:56 AM


Views: 2732
Re: [dendro] Need help with small but tricky job

How are your single quoted strings escaped there? If it's a bash script, then there is no way to escape them. Or does a backslash work? Or doubling?

The simpliest form of this type of regex would be the following. Basically separate the the parsing of the single quoted values from the escaping of the space characters:


Code
my $str = q{command arg0='na me' arg1='oth r'}; 

$str =~ s{('.*?')}{my $q = $1; $q =~ s/(\s)/\\$1/g; $q}eg;

print $str;


If you give me more information on how your single quoted strings are escaped, I can show you a more complete regex. Examples of such escaping would be helpful.

- Miller


(This post was edited by miller on Apr 22, 2011, 9:58 AM)


Edit Log:
Post edited by miller (User) on Apr 22, 2011, 9:58 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives