I originally developed everything on a Linux production server so everything works nicely on *nix but now I"m trying to get everything to work on Windows and it's a night mare...
Heres my problem...I have numerous javascript functions which are passed file paths...
On Windows, these file paths look like:
Code: Select all
my_function('C:\somedir\something\index.php?whatever=test');The problem is, Javascript parses the strings and chokes because of the '\' inside the path Windows leaves...so a '\' MUST be preceeded by another '\' in either single or double quoted strings in most if not all languages I'm aware of.
The other problem, is it would be ALOT of work to find every single path and call add slashes on it or something similiar.
Thankfully I"m using a template engine and the entire ready to render content is at mt disposal before sending to client side...
So what I'm thinking...is...
Could someone show me how in regex I could escape the '\' inside javascript/html strings ONLY (addslashes on the entire buffer won't work) by preceeding it with another '\'
This should solve my problem
Will Windows backslashes as paths cause problems in HTML HREF, etc???
Or likely just Javascript strings eh?
So I just need some regex which looks for
Code: Select all
('|").('|")Cheers