Tapatalk

Find and replace function names

Find and replace function names

1

    Nov 20, 2005#1

    How can I replace this with a regular expression.

    "public int __ReplaceTheFirstLetter" or
    "public string __ReplaceTheFirstLetter"

    to

    "private int replaceTheFirstLetter"
    "private string replaceTheFirstLetter"

    I want to get rid of the double underscores and convert public to private and replace the first Cap. letter after the underscores to lowercase.

    6,685587
    Grand MasterGrand Master
    6,685587

      Nov 20, 2005#2

      It's not possible to lower not specified characters with a replace command. But this macro will do it.

      Important: Macro property option Continue if a Find with Replace not found must be enabled.

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOff
      Top
      Loop
      Find MatchCase RegExp "public +[a-z]+ +_+[A-Z]"
      IfFound
      ToLower
      Else
      ExitLoop
      EndIf
      EndLoop
      Top
      Find MatchCase RegExp "public +^([a-z]+^) +_+^([a-z]^)"
      Replace All "private ^1 ^2"
      UnixReOn

      Remove the last red command, if you use regular expression in UltraEdit style by default instead of Unix style.
      For UltraEdit v11.10c and lower see Advanced - Configuration - Find - Unix style Regular Expressions.
      For UltraEdit v11.20 and higher see Advanced - Configuration - Searching - Unix style Regular Expressions.
      Macro commands UnixReOn/UnixReOff modifies this setting.
      Best regards from an UC/UE/UES for Windows user from Austria