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

Re: REQUEST : Uppercase and lowercase in ^!Replace command.

Expand Messages
  • 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 1 of 5 , Feb 4, 2008
    • 0 Attachment
      --- 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 2 of 5 , Feb 4, 2008
      • 0 Attachment
        --- 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 3 of 5 , Feb 5, 2008
        • 0 Attachment
          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.