>I guess it's easier to use ffind to do the whole match, since the
> regular expression (/e"...") is case sensitive.
>
> Does this do it?
>
> global /i /q (dir/b | ffind /k /m /v /e"MA\d{8,8}_\d{4,4}\.jpg$" | for
> %fn in (@con:) ren /n "%fn" %@left[-15,%@name["%fn"]].jpg)
>
> On Mon, Jul 20, 2009 at 9:29 AM, Steve Fábián<> wrote:
>
>
> ---Quote---
>> Jim Cook wrote:
>> | global /i /q (*dir /b
>> | *MA[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]_[0-9][0-9][0-9][0-9].jpg
>> | |
>> | *ffind /c /v /m /k
>> | /T"MA" | for %fn in (@con:) echo ren /n "%fn"
>> | %@left[-15,%@name["%fn"]].jpg)
>> |
>> | Ugly, but seems to work. Piping through ffind /c is the key for my
>> | attempt.
>>
>> The only problem is that a filename like zMAzma00000000_0000.jpg matches
>> all
>> the tests, even though not matching the intended test.
>>
>> I don't see an alternative to using an IF test using the EQC operator on
>> the
>> specific characters, something like this:
>>
>> do fn in /s
>> *MA[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]_[0-9][0-9][0-9][0-9].jpg
>> *set n=%@name["%fn"]
>> *if "%@left[2,%@right[15,%n]]" EQC "MA" ren "%fn" %@left[-15,%n]].jpg
>> enddo
>>
>> BTW, Charles, are you sure you wanted %@left[-15,%@name["%fn"]], which
>> keeps
>> the leftmost 15 characters, potentially dropping some of the digits,
>> rather
>> than %@right[15,%@name["%fn"]] which would strip all characters matching
>> the
>> * portion of the search string, retaining MA and all digits?