ZTree.com  | ZEN  | About...  

 Index   Back

The "Theoretical" Part - It's Not Rule 5   [Discuss]

By: John Gruener     Orlando, Florida  
Date: Jun 27,2002 at 03:09
In Response to: Rule #5 needs to sink in (Slobodan Vujnovic)

> Example file name: ABEF.ABCDEF.ABC
>
> "B*E"*" = AF.ACDF.ABC

> I'm having a problem understanding the rule (Rule #5?) behind this one. It
> appears that a '*' in the replace string will keep(?) in the matched part of the
> name the number of matching chars.

This should be the case even without stating rule 5, which actually had a different purpose.

As always, the asterisk represents all, (zero or more), characters *between* 'B' and 'E', but not the 'B' or 'E' characters themselves. Since the Replace string has no characters before the asterisk to replace the 'B', and no characters after the asterisk to replace the 'E', they both are deleted.

> 1. In ABEF there are ZERO chars between BandE, so the resulting string is AF.

Exactly.

> 2. In ABCDEF there are TWO chars between BandE, C and D, resulting in ACDF.

Exactly.

> These are consistent with the above reasoning, but is this clear to everybody --
> do we need a rule to define this better? Rule #5 does talk about the number, but
> the wording could maybe be more explicit?

I don't think so, because all one really needs to understand is that the asterisk represents "zero or more characters", just as it does in Filespec and the Rename Mask. It should be clear that the *same* characters are represented in the Replace string as were represented in the Find string.

Rule 5 was actually meant to be a limitation rule that specifies that you could *not* have strings like the following:

"B?E"B???E"
"B*E"B?E"

In other words, the number of characters represented by wildcards in the Replace string must match the same number of characters in the Find string. To allow otherwise introduces further complications and even more rules.

> I think I'm confused because in all other contexts, like Filespec, B*E would
> match BxxxE and both B and E would appear in a selection; here, they disappear
> -- but LEAVE the stuff they enclose alone...

They only disappear because they were replaced by nothing. The 'B' could have been replaced with '34', and the 'E' replaced by '56', as shown in the 6th example in that group:

"B*E"34*56" = A3456F.A34CD56F.ABC

- John

1,993 views      
Thread locked
 

Messages in this Thread

 
96,637 Postings in 12,231 Threads, 350 registered users, 94 users online (0 registered, 94 guests)
Index | Admin contact |   Forum Time: Mar 29, 2024 - 12:06 pm UTC  |  Hits:62,404,995  (19,781 Today )
RSS Feed