Converting cases with UE style regular expression

Converting cases with UE style regular expression

3
NewbieNewbie
3

    13:18 - Aug 28#1

    With text such as:

    "    ! Determine which case"

    I'm wondering if it possible to use UltraEdit's Regular Expression style (as opposed to Perl) to lower the case of the first letter after "!"?  I was thinking something along these lines to catch the input:

    "    ! ^([A-Z]^)^([a-z]^)"

    But I'm not seeing how the first tag (^1) could then be replaced by it's lowercase equivalent using an UltraEdit style regular expression?

    6,671577
    Grand MasterGrand Master
    6,671577

      16:29 - Aug 28#2

      The legacy UltraEdit and Unix regular expression engines do not support changing the case of letters during the replace as the powerful Perl regular expression engine.

      It would be necessary to use a macro which runs an UltraEdit regular expression find in a loop and uses the UltraEdit command to convert the found string to lower case.

      Code: Select all

      InsertMode
      ColumnModeOff
      HexOff
      UltraEditReOn
      Top
      Loop 0
      Find MatchCase RegExp "! [A-Z]"
      IfFound
      ToLower
      Else
      ExitLoop
      EndIf
      EndLoop
      The macro command UltraEditReOn is UnixReOff in very old versions of UltraEdit with no support for the Perl regular expression engine.
      Best regards from an UC/UE/UES for Windows user from Austria

      19376
      MasterMaster
      19376

        8:37 - Aug 29#3

        Hi Emorway,

        Just out of curiosity - why not Perl regexp?

        Thanks, Fleggy

        1

          11:36 - Today#4

          Hello!
          UltraEdit’s legacy regular expression engine doesn’t support changing the case of letters during replacement directly. However, you can achieve this using a macro. Here’s a simple example:

          Open UltraEdit and go to Advanced > Macros > Start Recording.
          Perform a find and replace using the following steps:
          Find: ! [A-Z]
          Replace: (leave this blank)
          After finding the match, use the Convert to Lowercase command.
          Stop recording the macro and save it.
          Here’s a sample macro script:

          InsertMode
          ColumnModeOff
          HexOff
          UltraEditReOn
          Top
          Loop 0
          Find MatchCase RegExp "! [A-Z]"
          IfFound
              ToLower
          Else
              ExitLoop
          EndIf
          EndLoop