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

REQUEST : Uppercase and lowercase in ^!Replace command.

Expand Messages
  • leroydennis254
    Hi, could it be possible to make an extra replace command, for example : $1 = normal replace $U1 = UPPERCASE replace $l1 = lowercase replace Thanks !
    Message 1 of 5 , Feb 4, 2008
      Hi,

      could it be possible to make an extra replace command, for example :

      $1 = normal replace
      $U1 = UPPERCASE replace
      $l1 = lowercase replace

      Thanks !
    • Sheri
      ... Those are nice and are implemented in both AutoHotkey and PowerPro. NoteTab is dependent on a 3rd party Delphi api for its regular expression processing
      Message 2 of 5 , Feb 4, 2008
        --- In ntb-clips@yahoogroups.com, "leroydennis254"
        <leroydennis254@...> wrote:
        >
        > Hi,
        >
        > could it be possible to make an extra replace command, for example :
        >
        > $1 = normal replace
        > $U1 = UPPERCASE replace
        > $l1 = lowercase replace
        >
        > Thanks !
        >

        Those are nice and are implemented in both AutoHotkey and PowerPro.

        NoteTab is dependent on a 3rd party Delphi api for its regular
        expression processing (including replacement string tokens - they are
        documented under Substring Replacements in the Regular Expressions
        Help file) so I doubt you'll be seeing that enhancement anytime soon.
        But you can also include external script calls or command lines (e.g.,
        for autohotkey or PowerPro) in your clips if you want.

        Otherwise (with pure clipcode), use a loop. Find the next character,
        word or sentence that needs a change in text case. Use ^!IfError after
        the ^!Find to get out of the loop if there are no more matches. When
        there is a match, use ^!InsertText to apply your text case change to
        ^$GetSelection$. The relevant functions are ^$StrLower$, ^$StrUpper$,
        ^$SetCapitalize$ and ^$StrSentenceCase$. Then restart your loop.

        Regards,
        Sheri
      • ebbtidalflats
        ... Another way to do this, if the target is known and constant, is to use a NON-reg-exp in the following way: ^!Set %variable%=target string ^!Replace
        Message 3 of 5 , Feb 4, 2008
          --- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@...> wrote:
          >
          > > $1 = normal replace
          > > $U1 = UPPERCASE replace
          > > $l1 = lowercase replace

          > But you can also include external script calls or command lines (e.g.,
          > for autohotkey or PowerPro) in your clips if you want.
          >
          > Otherwise (with pure clipcode), use a loop. Find the next character,
          > word or sentence that needs a change in text case. Use ^!IfError



          Another way to do this, if the target is known and constant, is to use
          a NON-reg-exp in the following way:

          ^!Set %variable%=target string
          ^!Replace ^%variable% ^$StrUpper("^%variable%")$ IAS

          This will find all combination of upper and lower case target strings,
          and convert them to upper case only.


          Cheers,


          Eb
        • leroydennis254
          ... Thanks, the problem is, I need to do this in a ^!Replace function. (line by line) I found this in the regexp helpfile, but God only knows how to use these
          Message 4 of 5 , Feb 4, 2008
            --- In ntb-clips@yahoogroups.com, "ebbtidalflats" <ebbtidalflats@...> wrote:
            >
            > --- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@> wrote:
            > >
            > > > $1 = normal replace
            > > > $U1 = UPPERCASE replace
            > > > $l1 = lowercase replace
            >
            > > But you can also include external script calls or command lines (e.g.,
            > > for autohotkey or PowerPro) in your clips if you want.
            > >
            > > Otherwise (with pure clipcode), use a loop. Find the next character,
            > > word or sentence that needs a change in text case. Use ^!IfError
            >
            >
            >
            > Another way to do this, if the target is known and constant, is to use
            > a NON-reg-exp in the following way:
            >
            > ^!Set %variable%=target string
            > ^!Replace ^%variable% ^$StrUpper("^%variable%")$ IAS
            >
            > This will find all combination of upper and lower case target strings,
            > and convert them to upper case only.
            >
            >
            > Cheers,
            >
            >
            > Eb
            >
            Thanks, the problem is, I need to do this in a ^!Replace function. (line by line)

            I found this in the regexp helpfile, but God only knows how to use these :

            CHARACTER CLASSES


            [...] positive character class
            [^...] negative character class
            [x-y] range (can be used for hex characters)
            [[:xxx:]] positive POSIX named set
            [[:^xxx:]] negative POSIX named set

            alnum alphanumeric
            alpha alphabetic
            ascii 0-127
            blank space or tab
            cntrl control character
            digit decimal digit
            graph printing, excluding space
            lower lower case letter
            print printing, including space
            punct printing, excluding alphanumeric
            space whitespace
            upper upper case letter
            word same as \w
            xdigit hexadecimal digit



            I've been trying and trying, but no luck. According to the helpfile, there should be something like [[:upper:]] , but I can't get it doen. :(
          • Sheri
            ... Those are posix character classes, they work on the search side only. ^!Find . +[[:lower:]] RS You can do the same thing with a range: ^!Find .
            Message 5 of 5 , Feb 5, 2008
              leroydennis254 wrote:
              > Thanks, the problem is, I need to do this in a ^!Replace function. (line by line)
              >
              > I found this in the regexp helpfile, but God only knows how to use these :
              >
              > CHARACTER CLASSES
              >
              >
              > [...] positive character class
              > [^...] negative character class
              > [x-y] range (can be used for hex characters)
              > [[:xxx:]] positive POSIX named set
              > [[:^xxx:]] negative POSIX named set
              >
              > alnum alphanumeric
              > alpha alphabetic
              > ascii 0-127
              > blank space or tab
              > cntrl control character
              > digit decimal digit
              > graph printing, excluding space
              > lower lower case letter
              > print printing, including space
              > punct printing, excluding alphanumeric
              > space whitespace
              > upper upper case letter
              > word same as \w
              > xdigit hexadecimal digit
              >
              >
              >
              > I've been trying and trying, but no luck. According to the helpfile, there should be something like [[:upper:]] , but I can't get it doen. :(
              >
              >
              Those are posix character classes, they work on the search side only.

              ^!Find "\. +[[:lower:]]" RS

              You can do the same thing with a range:

              ^!Find "\. +[a-z]" RS

              If you use a \K where you want the match to start, it will require the
              period and one or more spaces, but will select only what follows.

              ^!Find "(?:^ *|\. +)\K[a-z]" RS

              That will find lower case letters at the start of a paragraph after
              optional spaces or after a period followed by one or more spaces.

              Then you can upcase the selection.
              ^!Menu Modify/Text Case/Upper Case
              or
              ^!InsertText ^$StrUpper(^$GetSelection$)$

              Do it in a loop until no more are found.

              :Loop
              ^!Find "(?:^ *|\. +)\K[a-z]" RS
              ^!Iferror Out
              ^!Menu Modify/Text Case/Upper Case
              ^!Goto Loop
              :Out

              If you don't have other miscellaneous proper names or capitalizations in
              the document, you can do this instead. It will modify the entire
              document at once:

              ^!Select All
              ^!Menu Modify/Text Case/Sentence

              Regards,
              Sheri
            Your message has been successfully submitted and would be delivered to recipients shortly.