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

Re: [NTS] Changing Case with Regex

Expand Messages
  • Don - HtmlFixIt.com
    I was thinking if you just use the function that assigns regex to variables, then you could do it that way, but I can never find that function in help. It is
    Message 1 of 10 , Jun 8, 2008
    • 0 Attachment
      I was thinking if you just use the function that assigns regex to
      variables, then you could do it that way, but I can never find that
      function in help. It is a fairly new function ... I think we were just
      discussing it last week and I know I used it in the last week in a clip,
      but cannot find it once again ...

      Don
    • Sheri
      ... ^$GetReSubStrings$ ? Its used after a ^!Find command.
      Message 2 of 10 , Jun 8, 2008
      • 0 Attachment
        Don - HtmlFixIt.com wrote:
        > I was thinking if you just use the function that assigns regex to
        > variables, then you could do it that way, but I can never find that
        > function in help. It is a fairly new function ... I think we were just
        > discussing it last week and I know I used it in the last week in a clip,
        > but cannot find it once again ...
        >
        > Don
        >
        >
        ^$GetReSubStrings$ ? Its used after a ^!Find command.
      • Don - HtmlFixIt.com
        ... Right that should do it. Regex find, use getresubstring (how will I ever remember this one? -- and why don t I find it if I look for variable and regex in
        Message 3 of 10 , Jun 8, 2008
        • 0 Attachment
          Sheri wrote:
          > Don - HtmlFixIt.com wrote:
          >> I was thinking if you just use the function that assigns regex to
          >> variables, then you could do it that way, but I can never find that
          >> function in help. It is a fairly new function ... I think we were just
          >> discussing it last week and I know I used it in the last week in a clip,
          >> but cannot find it once again ...
          >>
          >> Don
          >>
          >>
          > ^$GetReSubStrings$ ? Its used after a ^!Find command.

          Right that should do it. Regex find, use getresubstring (how will I
          ever remember this one? -- and why don't I find it if I look for
          variable and regex in help?) then uppercase the right variable and put
          them back in.
        • John Shotsky
          Here s the loop I m using - can this be made faster? I only locate those which include a lower case character in the find. I use the toolbar function, but I
          Message 4 of 10 , Jun 8, 2008
          • 0 Attachment
            Here's the loop I'm using - can this be made faster?

            I only locate those which include a lower case character in the find. I use the toolbar function, but I don't know if
            there's a time penalty for this type of loop. There are about 45K lines in my typical document.And about 1000 expected
            'finds'.

            :Loop
            ^!Find "^Title: .+[a-z]" ARSTW
            ^!IfError GoTo End
            ^!SELECT LINE
            ^!Toolbar "upper case"
            ^!Goto Loop
            :End

            John

            From: ntb-scripts@yahoogroups.com [mailto:ntb-scripts@yahoogroups.com] On Behalf Of Sheri
            Sent: Sunday, June 08, 2008 5:30 PM
            To: ntb-scripts@yahoogroups.com
            Subject: Re: [NTS] Changing Case with Regex

            Don - HtmlFixIt.com wrote:
            > I was thinking if you just use the function that assigns regex to
            > variables, then you could do it that way, but I can never find that
            > function in help. It is a fairly new function ... I think we were just
            > discussing it last week and I know I used it in the last week in a clip,
            > but cannot find it once again ...
            >
            > Don
            >
            >
            ^$GetReSubStrings$ ? Its used after a ^!Find command.



            [Non-text portions of this message have been removed]
          • Sheri
            ... There is a time penalty for loops but it should be at least twice as fast this way: ^!SetScreenUpdate Off ^!Set %start%=^$GetDate(hh:mm:ss)$ ^!StatusShow
            Message 5 of 10 , Jun 8, 2008
            • 0 Attachment
              John Shotsky wrote:
              > Here's the loop I'm using - can this be made faster?
              >
              > I only locate those which include a lower case character in the find. I use the toolbar function, but I don't know if
              > there's a time penalty for this type of loop. There are about 45K lines in my typical document.And about 1000 expected
              > 'finds'.
              >
              > :Loop
              > ^!Find "^Title: .+[a-z]" ARSTW
              > ^!IfError GoTo End
              > ^!SELECT LINE
              > ^!Toolbar "upper case"
              > ^!Goto Loop
              > :End
              >
              There is a time penalty for loops but it should be at least twice as fast this way:

              ^!SetScreenUpdate Off
              ^!Set %start%=^$GetDate(hh:mm:ss)$
              ^!StatusShow Working
              ^!Jump Doc_Start
              :Loop
              ^!Find "(?-i)(?<=^Title: ).*[a-z].*$" RS
              ^!IfError GoTo Finish
              ^$StrUpper(^$GetSelection$)$
              ^!Goto Loop
              :Finish
              ^!StatusShow
              ^!Set %endtime%=^$GetDate(hh:mm:ss)$
              ^!Info ^%start%^%nl%^%endtime%
              ;end of clip

              Btw, you previously said you wanted
              Title: A DOG'S TALE
              but your loop produces
              TITLE: A DOG'S TALE
            • John Shotsky
              Thanks! And, you re right, it was uppercasing the Title also.I like your version much better.. John From: ntb-scripts@yahoogroups.com
              Message 6 of 10 , Jun 8, 2008
              • 0 Attachment
                Thanks! And, you're right, it was uppercasing the Title also.I like your version much better..

                John

                From: ntb-scripts@yahoogroups.com [mailto:ntb-scripts@yahoogroups.com] On Behalf Of Sheri
                Sent: Sunday, June 08, 2008 9:00 PM
                To: ntb-scripts@yahoogroups.com
                Subject: Re: [NTS] Changing Case with Regex

                John Shotsky wrote:
                > Here's the loop I'm using - can this be made faster?
                >
                > I only locate those which include a lower case character in the find. I use the toolbar function, but I don't know if
                > there's a time penalty for this type of loop. There are about 45K lines in my typical document.And about 1000 expected
                > 'finds'.
                >
                > :Loop
                > ^!Find "^Title: .+[a-z]" ARSTW
                > ^!IfError GoTo End
                > ^!SELECT LINE
                > ^!Toolbar "upper case"
                > ^!Goto Loop
                > :End
                >
                There is a time penalty for loops but it should be at least twice as fast this way:

                ^!SetScreenUpdate Off
                ^!Set %start%=^$GetDate(hh:mm:ss)$
                ^!StatusShow Working
                ^!Jump Doc_Start
                :Loop
                ^!Find "(?-i)(?<=^Title: ).*[a-z].*$" RS
                ^!IfError GoTo Finish
                ^$StrUpper(^$GetSelection$)$
                ^!Goto Loop
                :Finish
                ^!StatusShow
                ^!Set %endtime%=^$GetDate(hh:mm:ss)$
                ^!Info ^%start%^%nl%^%endtime%
                ;end of clip

                Btw, you previously said you wanted
                Title: A DOG'S TALE
                but your loop produces
                TITLE: A DOG'S TALE



                [Non-text portions of this message have been removed]
              • Sheri
                ... Just noticed, that ^!IfError shouldn t have the word GoTo in it... s/b: ^!IfError Finish
                Message 7 of 10 , Jun 8, 2008
                • 0 Attachment
                  John Shotsky wrote:
                  > Thanks! And, you're right, it was uppercasing the Title also.I like your version much better..
                  >
                  Just noticed, that ^!IfError shouldn't have the word GoTo in it...

                  s/b:

                  ^!IfError Finish
                • Alec Burgess
                  On Sun, Jun 8, 2008 at 10:15 PM, Don - HtmlFixIt.com ... Right that should do it. Regex find, use getresubstring (how will I ... In
                  Message 8 of 10 , Jun 10, 2008
                  • 0 Attachment
                    On Sun, Jun 8, 2008 at 10:15 PM, Don - HtmlFixIt.com <don@...>
                    wrote:
                    > ^$GetReSubStrings$ ? Its used after a ^!Find command.

                    Right that should do it. Regex find, use getresubstring (how will I
                    > ever remember this one? -- and why don't I find it if I look for
                    > variable and regex in help?) then uppercase the right variable and put
                    > them back in
                    >

                    In Help-favorites for Clips I've put the Find-Replace topic because I ALWAYS
                    forget the names of the new regex associated functions too! (Also the pages
                    that define what all the funny symbols & and * mean where and when and what
                    the pre-defined variables and goto targets are. I ALWAYS have to look for
                    them to use in a script :-(

                    --
                    Regards ... Alec
                    --


                    [Non-text portions of this message have been removed]
                  Your message has been successfully submitted and would be delivered to recipients shortly.