Page 1 of 1

regexreplace multi spaces

Posted: 20 Mar 2017 16:19
by yusef88
Hi... this removes space at end of name

Code: Select all

rename r, "^\s*(.*?)\s*(\.[^\.]*)$ > $1$2", p;
but can it work with regexreplace ?

Code: Select all

text regexreplace("mm  ", "^\s*(.*?)\s*(\.[^\.]*)$", "$1$2");

Re: regexreplace multi spaces

Posted: 20 Mar 2017 16:29
by bdeshi
The regex pattern actually removes spaces from the end of the BASE name, before the extension. What you want is much simpler.

Code: Select all

text regexreplace("mm  ", "\s+$", "");

Re: regexreplace multi spaces

Posted: 21 Mar 2017 07:47
by yusef88
THANK YOU! :tup: