Re: [Clip] Re: Trouble with clip
I thought you could not use variables in regex, I have tried a couple and
they did not work ,the track 01 is part of the replaced side.
THANKYOU DAVE M
----- Original Message -----
From: "Sheri" <silvermoonwoman@...>
Sent: Saturday, November 03, 2007 12:41 AM
Subject: [Clip] Re: Trouble with clip
> --- In email@example.com, "Dave" <dmc43959@...> wrote:
>> the clip below works almost correctly but how can I increment the
>> TRACK 01 and the second bit is in replace what do you put for
>> spaces in the replaced side ,the clip below has spaces in the
>> replaced side.
>> 1. Zorg - Nocturnal (Original) [Ucmg]
>> 2. Ulrich Schnauss - Monday-Paracetomol [City Centre Offices]
>> 3. Vessel - Koozbane [Expanding]
>> 4. Deru - Echos Of Me [Neo Ouija]
>> 5. Vessel - Balance [Expanding]
>> H="CUE TRACKS"
>> ^!set %num%=1
>> ^!InsertText PERFORMER "^%PERFORMER%"
>> ^!InsertText ^pTITLE "^%TITLE%"
>> ^!InsertText ^pFILE "^%FILE%" MP3
>> ^!InsertText ^p
>> ^!inc %num%
>> ^!DELAY 2
>> ^!Replace "^(\d*\.)\s" >> "" ATIWRS
>> ^!Replace "\s\-\s" >> "\" ATIWRS
>> ^!Jump Doc_Start
>> ^!Replace "^(.*)\\(.*)" >> " TRACK 01 AUDIO\r\n TITLE "$2"\r\n
>> PERFORMER "$1"\r\n INDEX 01 00:00:00" ATIWRS
>> ^!IF ^%num% <= ^$Calc(^%TRACKS%)$ LOOP
> Spaces in regex replacement text can be written as \x20
> You can use ^%num% for your track number, but you would have to be
> acting on only one track at a time, e.g., advancing the cursor line by
> line, and not using A (=All) or W (=Whole Document) options for that
> part. T has no effect in regex replacements. Also, there is no need
> for "^!Jump Doc_Start" before acting on All in the Whole document.
> Fookes Software: http://www.fookes.com/
> Fookes Software Discussion Lists: http://www.fookes.com/groups.php
> Yahoo! Groups Links
- --- In firstname.lastname@example.org, "Dave" <dmc43959@...> wrote:
>You can use a variable on the replace side. But if you apply it to all
> Hi I thought you could not use variables in regex, I have tried a
> couple and they did not work ,the track 01 is part of the
> replaced side.
occurrences in the whole document, the value of the variable will be
the same for all the replacements.
As long as the expanded variable doesn't look like it would have
special meaning in the replacement text (e.g., have a dollar sign or
backslash in it) everything should be fine. The replacement text is
not a regular expression. You can also use an expanded variable to
represent literal text on the search side where the regular expression
is, but then you would need to ensure that any metacharacters stored
in the variable got escaped before processing.
Here's a clip that demonstrates using a variable on the replacement
side. It keeps a zero in front of track numbers less than 10.
^!Toolbar New Document
^!Prompt See the sample document
^!If ^%num%<10 Next Else Skip_1
^!Find "\x20\x20TRACK 01 AUDIO" RS
^!Replace "\d+" >> "^%numstr%" RHS
^!Prompt Each Track Number has been replaced
;end of clip