[Beta] Bug in MRT using RegExp is still present

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
XPEHOPE3KA
Power Member
Power Member
Posts: 854
Joined: 2006-03-03, 18:23 UTC
Location: Saint-Petersburg, Russia

[Beta] Bug in MRT using RegExp is still present

Post by *XPEHOPE3KA »

I needed to rename such files as
1_bla.txt
13_blabla.txt
423_blablabla.txt
and so on (less than four digits, numbers are NOT suitable for [C]!!!)

I decided to do it like this (regexp enabled):
Search for: ^(\d\d)_(.*)|^(\d)_(.*)
Replace with: 0$1_$2|00$3_$4
But that doesn't work properly - the | symbol is inserted in the resulting filename, while it normally is for splitting "search for"s and "replace with"s from each other.

I know I can perform the desired renaming in two steps, but why can't I use the | symbol?
Last edited by XPEHOPE3KA on 2006-06-22, 19:40 UTC, edited 1 time in total.
User avatar
XPEHOPE3KA
Power Member
Power Member
Posts: 854
Joined: 2006-03-03, 18:23 UTC
Location: Saint-Petersburg, Russia

Post by *XPEHOPE3KA »

Anybody out there, please confirm that it's impossible to use | symbol together with regular expressions.
F6, Enter, Tab, F6, Enter, Tab, F6, Enter, Tab... - I like to move IT, move IT!..
VadiMGP
Power Member
Power Member
Posts: 672
Joined: 2003-04-05, 12:11 UTC
Location: Israel

Post by *VadiMGP »

Yes, it is impossible to use | in replacement string.
It is allowed in search only.
User avatar
XPEHOPE3KA
Power Member
Power Member
Posts: 854
Joined: 2006-03-03, 18:23 UTC
Location: Saint-Petersburg, Russia

Post by *XPEHOPE3KA »

But why?
You know, if I have a file "aaabbb.txt", and "search for"=aaa|bbb, and "replace with"=ccc|ddd than I will get cccddd.txt. So I want this with regexps too.
Maybe, regexps have some syntax which doesn't allow |?
F6, Enter, Tab, F6, Enter, Tab, F6, Enter, Tab... - I like to move IT, move IT!..
User avatar
Sheepdog
Power Member
Power Member
Posts: 5150
Joined: 2003-12-18, 21:44 UTC
Location: Berlin, Germany
Contact:

Post by *Sheepdog »

That question can probably only answered by @ghisler.

sheepdog
"A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete fools."
Douglas Adams
User avatar
majkinetor !
Power Member
Power Member
Posts: 1580
Joined: 2006-01-18, 07:56 UTC
Contact:

Post by *majkinetor ! »

I agree. That should be fixed.
Habemus majkam!
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

You know, if I have a file "aaabbb.txt", and "search for"=aaa|bbb, and "replace with"=ccc|ddd than I will get cccddd.txt. So I want this with regexps too.
You cannot mix regexp and TC specific search attributes. They are two different engines. The regular expression syntax does not allow pipes in a replacemet expression. AFAIK.
I switched to Linux, bye and thanks for all the fish!
User avatar
XPEHOPE3KA
Power Member
Power Member
Posts: 854
Joined: 2006-03-03, 18:23 UTC
Location: Saint-Petersburg, Russia

Post by *XPEHOPE3KA »

It doesn't, but Ghisler should take care of that. Now TC parses those two strings without any notice to TC's | when regexp is enabled.
| in regexps stands for "or" in such expression (bla|anotherbla|somethingelse), so it may be a little hard to distinguish where | belongs to regexp and where to TC internal syntax. To avoid this, I guess, the symbol | should be changed to something else in internal syntax.
F6, Enter, Tab, F6, Enter, Tab, F6, Enter, Tab... - I like to move IT, move IT!..
User avatar
majkinetor !
Power Member
Power Member
Posts: 1580
Joined: 2006-01-18, 07:56 UTC
Contact:

Post by *majkinetor ! »

I agree. That should be fixed.
Habemus majkam!
User avatar
XPEHOPE3KA
Power Member
Power Member
Posts: 854
Joined: 2006-03-03, 18:23 UTC
Location: Saint-Petersburg, Russia

Post by *XPEHOPE3KA »

Just to keep the topic topmost until Mr. Ghisler comes, maybe let's discuss a possible replacement of |?
BTW, the | can be left as it is, if regexp switch is off, so most users (2m :wink: care for newbies) won't notice any difference.
AFAIC, ! can be used, as it's not used in regexps. Double ! will stand for '!'. What do you think?
F6, Enter, Tab, F6, Enter, Tab, F6, Enter, Tab... - I like to move IT, move IT!..
User avatar
XPEHOPE3KA
Power Member
Power Member
Posts: 854
Joined: 2006-03-03, 18:23 UTC
Location: Saint-Petersburg, Russia

Post by *XPEHOPE3KA »

Ah, yes. ! can't be used as then this string in "search for" field won't be recognized:
bla.!!!!otherbla.tx!!

But slash / seems to be a good solution. It can't be used neither in filenames nor in regular expressions.
F6, Enter, Tab, F6, Enter, Tab, F6, Enter, Tab... - I like to move IT, move IT!..
User avatar
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
Contact:

Post by *Flint »

I support the request: replacing of multiple strings should work with regular expressions too. If there are doubts that the users mey become confused, this behaviour may be controlled by an additional wincmd.ini option.
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
 
Using TC 10.52 / Win10 x64
User avatar
XPEHOPE3KA
Power Member
Power Member
Posts: 854
Joined: 2006-03-03, 18:23 UTC
Location: Saint-Petersburg, Russia

Post by *XPEHOPE3KA »

This bug is still present in TC 6.55pb1.
F6, Enter, Tab, F6, Enter, Tab, F6, Enter, Tab... - I like to move IT, move IT!..
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48093
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

You cannot use the | for multiple strings together with regular expressions. This is not supported, and it's currently not planned either, sorry.
Author of Total Commander
https://www.ghisler.com
User avatar
XPEHOPE3KA
Power Member
Power Member
Posts: 854
Joined: 2006-03-03, 18:23 UTC
Location: Saint-Petersburg, Russia

Post by *XPEHOPE3KA »

Why not? It's fixable easily - see the upper postings:
http://ghisler.ch/board/viewtopic.php?p=87655#87655
and the next.
F6, Enter, Tab, F6, Enter, Tab, F6, Enter, Tab... - I like to move IT, move IT!..
Post Reply