RegExp rename problem with spaces[EXPLAINED]

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

RegExp rename problem with spaces[EXPLAINED]

Post by bdeshi »

Try to regexp rename this file with that pattern:

Code: Select all

"The        Spacious.txt"

Code: Select all

"^The > "
Only "the" should be replaced with "", but all those spaces are replaced too! Why? Fix how?

Sorry for two back-to-back reports, but found out about the other bug/confusion while testing this one.

EDIT:pattern typo+standardization
Last edited by bdeshi on 15 May 2014 08:06, edited 4 times in total.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: RegExp rename problem with spaces

Post by Stefan »

It is a MS design rule that a file name must not have leading spaces.
XY follow this rule. Only some managers, like DOS, allow to keep or add leading spaces.
There must be a post about this topic already somewhere...


And... why

Code: Select all

"^\t\h\e > "
?

One would simple use "^the > "

"\t" is a meta char to match a tab in RegEx.



- - -

If you really want to keep leading spaces, RegEx rename

Code: Select all

"^the\s > #"


while instead of # -sign you would hold the Alt-key and type 255 on the numpad.

This will exchange the space after 'the' with a "non-breaking space". (visit a ASCII table)




.

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: RegExp rename problem with spaces

Post by bdeshi »

Okay, thanks!

I know I don't have to escape literal alphabets, but the T was actually capital (typo) and the slashes escaped dots originally and were kept in.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Post Reply