To replace the matched pattern with nothing (Solved)

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
John_C
Posts: 336
Joined: 16 May 2018 20:04

To replace the matched pattern with nothing (Solved)

Post by John_C »

When we use the regex mode of rename, what is the proper way to replace the matched pattern with nothing? (I.e. to remove it.)

Here is what I use currently:

Code: Select all

::rename r, '(#[^\.]+|@.+$) > ';
It works, but > (> and space) doesn't look very good.
Last edited by John_C on 29 Nov 2019 10:41, edited 1 time in total.

highend
Posts: 15016
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: To replace the matched pattern with nothing

Post by highend »

You are free to tweak it?
RegExpRenameSep=
One of my scripts helped you out? Please donate via Paypal

John_C
Posts: 336
Joined: 16 May 2018 20:04

Re: To replace the matched pattern with nothing

Post by John_C »

It seems you mean to change > to something different. But my question is about the space, not >.

Something like

Code: Select all

::rename r, '(#[^\.]+|@.+$) > ""';
would be (probably) better.

highend
Posts: 15016
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: To replace the matched pattern with nothing

Post by highend »

And you can remove the space by tweaking it...
RegExpRenameSep=">"
Hence:
::rename r, '(#[^\.]+|@.+$)>';
One of my scripts helped you out? Please donate via Paypal

John_C
Posts: 336
Joined: 16 May 2018 20:04

Re: To replace the matched pattern with nothing

Post by John_C »

I see, thanks. Well, it seems that current way is the the proper one (already).

Post Reply