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
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
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
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!