Hi. I'm trying to figure out some regex to do the following;
1) Remove any non-standard charachters, and replace them with _ (i.e @!"£$%^&*()- etc)
2) If the file is named file.image.gif, I want to replace the first . with a _. For example;
name.image.gif, would become name_image.gif.
Not all files age going to be like this.. for example;
file.gif
image.jpg
...etc.
Any ideas? i would imagine something like this to get rid of non-words;
$var =~ s/\W/_/gi;
...but I'm confused about the dot part :(
TIA
Andy (mod)
andy@ultranerds.co.uk
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
1) Remove any non-standard charachters, and replace them with _ (i.e @!"£$%^&*()- etc)
2) If the file is named file.image.gif, I want to replace the first . with a _. For example;
name.image.gif, would become name_image.gif.
Not all files age going to be like this.. for example;
file.gif
image.jpg
...etc.
Any ideas? i would imagine something like this to get rid of non-words;
$var =~ s/\W/_/gi;
...but I'm confused about the dot part :(
TIA
Andy (mod)
andy@ultranerds.co.uk
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates

