Loading ...
Sorry, an error occurred while loading the content.
 

Re: [Clip] Re: Trouble with clip

Expand Messages
  • Dave
    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. THANKYOU DAVE M ...
    Message 1 of 4 , Nov 2, 2007
      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.
      THANKYOU DAVE M

      ----- Original Message -----
      From: "Sheri" <silvermoonwoman@...>
      To: <ntb-clips@yahoogroups.com>
      Sent: Saturday, November 03, 2007 12:41 AM
      Subject: [Clip] Re: Trouble with clip


      > --- In ntb-clips@yahoogroups.com, "Dave" <dmc43959@...> wrote:
      >>
      >> Hi
      >> 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
      >> ^!Set
      >>
      > %PERFORMER%="^?{PERFORMER=}";%TITLE%="^?{TITLE=}";%FILE%="^?{FILE=}";%TRACKS%="^?{TRACKS=}"
      >> ^!InsertText PERFORMER "^%PERFORMER%"
      >> ^!InsertText ^pTITLE "^%TITLE%"
      >> ^!InsertText ^pFILE "^%FILE%" MP3
      >> ^!InsertText ^p
      >> :loop
      >> ^!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
      >> :EXIT
      >>
      >
      > 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.
      >
      > Regards,
      > Sheri
      >
      >
      >
      > Fookes Software: http://www.fookes.com/
      > Fookes Software Discussion Lists: http://www.fookes.com/groups.php
      > Yahoo! Groups Links
      >
      >
      >
      >
    • Sheri
      ... You can use a variable on the replace side. But if you apply it to all occurrences in the whole document, the value of the variable will be the same for
      Message 2 of 4 , Nov 2, 2007
        --- In ntb-clips@yahoogroups.com, "Dave" <dmc43959@...> wrote:
        >
        > 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.

        You can use a variable on the replace side. But if you apply it to all
        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
        ^!InsertText ^%Space%^%Space%TRACK^%Space%01^%Space%AUDIO^%NL%
        ^!InsertText ^%Space%^%Space%TRACK^%Space%01^%Space%AUDIO^%NL%
        ^!InsertText ^%Space%^%Space%TRACK^%Space%01^%Space%AUDIO^%NL%
        ^!InsertText ^%Space%^%Space%TRACK^%Space%01^%Space%AUDIO^%NL%
        ^!InsertText ^%Space%^%Space%TRACK^%Space%01^%Space%AUDIO^%NL%
        ^!Jump Doc_Start
        ^!Prompt See the sample document
        ^!Set %num%=0
        :Loop
        ^!Inc %num%
        ^!Set %numstr%=^%num%
        ^!If ^%num%<10 Next Else Skip_1
        ^!Set %numstr%=0^%num%
        ^!Find "\x20\x20TRACK 01 AUDIO" RS
        ^!IfError Out
        ^!Replace "\d+" >> "^%numstr%" RHS
        ^!Goto Loop
        :Out
        ^!Prompt Each Track Number has been replaced
        ;end of clip
      Your message has been successfully submitted and would be delivered to recipients shortly.