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

Re: [NTS] Changing Case with Regex

Expand Messages
  • 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 1 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 2 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 3 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 4 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.