Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Cleaning Whitespace from Source Code (re)

by tye (Sage)
on Dec 09, 2004 at 16:59 UTC ( [id://413617]=note: print w/replies, xml ) Need Help??


in reply to Re: Cleaning Whitespace from Source Code
in thread Cleaning Whitespace from Source Code

Parser, smarser. Just use a simple regex. As a start:

s{ ( # $1 for whole match ' (?: \\. | [^']+ )* ' # 'string' | " (?: \\. | [^"]+ )* " # "string" | (?:^|\r*\n)[^\S\n]* # leading spaces | ([^\S\n]+) # $2 is trivial spaces ) }{ $2 ? ' ' : $1 }gsex

- tye        

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://413617]
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: (6)
As of 2024-04-23 13:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found