Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: solution wanted for break-on-spaces (w/specifics)

by LanX (Saint)
on Oct 24, 2021 at 00:30 UTC ( [id://11137931]=note: print w/replies, xml ) Need Help??


in reply to Re: solution wanted for break-on-spaces (w/specifics)
in thread solution wanted for break-on-spaces (w/specifics)

I'm not sure about this

(?:(?<!\\)\")

I read it as doublequote which is not preceded by backslash

But what about an escaped backslash \\" or two \\\\" ... ?

I'd rather try something like (Untested pseudocode)

s/^(?:$escaped|$quoted|\S)*\K\s+/\n/g

and

$escaped = qr/\\./; $quoted = qr/ (['"]) # start (?: $escaped | [^\1] )* # inside \1 # end, probably \g-1 better /x;

NB: I didn't cover the case of unclosed quotes, which is unclear anyway.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

update

tested - fails - good night! :)

update

see Re: solution wanted for break-on-spaces (w/specifics) for "working" example

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11137931]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-06-22 12:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.