perl regular expressions . . . .
Discussion
I am curently trying to compress files, aiming to reduce the file size even to the point of reducing whitespace.
$data3=~ s/\s+=\s+/=/g;
The above line is working nicely except for when i have text within strings that I dont want to be affected, has anyone written a regular expression that will leave alone all the text in strings while still reducing the rest of the code.
ie.
if the line is first
var a = 10;
var b = "This value = "+a);
I would like after compression to get
var a=10;
var b="This value = "+a);
Any further pointers would also be useful, currently working my way through all the perl websites and plenty of info but after bit sized chunks to kick off.
Cheers
$data3=~ s/\s+=\s+/=/g;
The above line is working nicely except for when i have text within strings that I dont want to be affected, has anyone written a regular expression that will leave alone all the text in strings while still reducing the rest of the code.
ie.
if the line is first
var a = 10;
var b = "This value = "+a);
I would like after compression to get
var a=10;
var b="This value = "+a);
Any further pointers would also be useful, currently working my way through all the perl websites and plenty of info but after bit sized chunks to kick off.
Cheers
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff


