my this code is not removing dots what is wrong he...
# cfml-general
g
my this code is not removing dots what is wrong here x = 'Screenshot20240418at7.58.15AM.jpg'; #dump(reReplace(x, '[^a-zA-Z0-9\.]', '', 'all'))#
r
reReplace(x, '[^a-zA-Z0-9\.]', '', 'all')
The last part of the regex keeps the dots
g
if i reove it, it also removes the dot between the extention
d
You need to process the extension differently from the rest of the name. You can figure this out, yes?
g
yea
r
Copy code
<cfscript>
x = 'Screenshot20240418at7.58.15AM.jpg';
ext = x.right(-4);
#dump(reReplace(x.left(-4), '[^a-zA-Z0-9]', '', 'all') & ext)#
</cfscript>
as an example
reverse()
is lucee specific though...
👍 1
Updated the code comment...