Page 1 of 1

To replace the matched pattern with nothing (Solved)

Posted: 29 Nov 2019 10:10
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.

Re: To replace the matched pattern with nothing

Posted: 29 Nov 2019 10:17
by highend
You are free to tweak it?
RegExpRenameSep=

Re: To replace the matched pattern with nothing

Posted: 29 Nov 2019 10:31
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.

Re: To replace the matched pattern with nothing

Posted: 29 Nov 2019 10:37
by highend
And you can remove the space by tweaking it...
RegExpRenameSep=">"
Hence:
::rename r, '(#[^\.]+|@.+$)>';

Re: To replace the matched pattern with nothing

Posted: 29 Nov 2019 10:40
by John_C
I see, thanks. Well, it seems that current way is the the proper one (already).