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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

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


Apr 22, 2011, 9:56 AM

Views: 3387
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:

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