regexreplace multi spaces

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
yusef88
Posts: 1126
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

regexreplace multi spaces

Post 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");

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: regexreplace multi spaces

Post 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+$", "");
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

yusef88
Posts: 1126
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Re: regexreplace multi spaces

Post by yusef88 »

THANK YOU! :tup:

Post Reply