Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^5: Regex with Backslashes

by haukex (Archbishop)
on May 18, 2020 at 20:29 UTC ( [id://11116917]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Regex with Backslashes
in thread Regex with Backslashes

The comma separated data is entered by a user and I want to keep it as simple as possible, so extra quoting is something I want to avoid.

Ok, I see, although there are of course other alternatives. Like for example, it may not be so difficult on the user if you require all fields to be quoted, that's one less rule for the user to remember. In the end, it'll be up to you to decide what is easiest for the user and for the implementation. I agree with AnomalousMonk's point that doubling up the commas leads to ambiguity, so if you really don't like the quoting, perhaps the backslashes are not such a bad idea (and the only issue was really the misunderstandings about the format); the parser I showed here has some pretty simple rules: commas are field separators, backslashes and commas can be escaped with backslashes, plus the support for the \x... sequence.

Replies are listed 'Best First'.
Re^6: Regex with Backslashes
by anita2R (Scribe) on May 18, 2020 at 21:04 UTC

    Thanks, I've downloaded your parser script and will see how it fits with what I have now. I think I prefer the escaped comma & escaped backslash option so it could be a solution.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-04-24 21:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found