Replacing "[A-Z]" to "_[A-Z]"

Replacing "[A-Z]" to "_[A-Z]"

3
NewbieNewbie
3

    Jun 02, 2006#1

    Hello,

    I am trying to change all uppercase letters so they get preceded by a "_" character.

    I have been able to find uppercase letters (using "[A-Z]" and checking the 'match case' box) but they get replaced by "_[A-Z]" instead of the found letter preceded by the "_".

    What syntax should I use?

    Thanks a lot!!

    344
    MasterMaster
    344

      Jun 02, 2006#2

      In Perl regexp (see your options) find:
      ([A-Z])
      replace with:
      _\1

      Of course the regexp-checkbox in find dialog has to be set.

      But I found out a strange behaviour: This search is dependant of the switch "ignore big/small characters" in the search dialog !!!

      If you switch to the meaning a=A, the regexp [A-Z] also finds a small "a" !?!?

      I thought when choosing regexp this switch should be ignored, since [a-z] would explicitly only find small letters ...

      Is it a feature ?

      12.10+3

      rds Bego
      Normally using all newest english version incl. each hotfix. Win 10 64 bit

      3
      NewbieNewbie
      3

        Jun 02, 2006#3

        Hi Bego,

        Thanks for your fast response, It is working for me now!! I had already tried that, but without the parenthesis (so it wasn't working indeed).

        Now I have a further question ( I am not sure if it needs another new topic or can be done in the same one).

        I would like this behaviour except por the first letter of a line. That is:
        If I have "ThisIsAnExample" I need "This_Is_An_Example" instead of "_This_Is_An_Example"

        Thanks a lot!

        6,675585
        Grand MasterGrand Master
        6,675585

          Re: Replacing "[A-Z]" to "_[A-Z]"

          Jun 02, 2006#4

          Bego, yes, it is a feature. [A-ZÄÖÜ] or [a-zäöü] means the same as [A-Za-zÄÖÜäöü] if the find option Match Case (English name) is not used.

          The syntax language definition keyword Nocase has the same influence on the regex function strings of the language definition as the find option "Match Case".
          Best regards from an UC/UE/UES for Windows user from Austria

          344
          MasterMaster
          344

            Re: Replacing "[A-Z]" to "_[A-Z]"

            Jun 02, 2006#5

            Hi Mofi,
            For me, I'd prefer that a "hard" [a-z] always means small characters.

            httptunnel:
            search: ([a-z])([A-Z])
            replace: \1_\2

            but it does not do: myTTTest to my_T_T_Test
            it changes it to my_TTTest (an my feeling says: that's ok for you) ;-)


            rds Bego
            Normally using all newest english version incl. each hotfix. Win 10 64 bit

            3
            NewbieNewbie
            3

              Jun 02, 2006#6

              Bego,

              Yes, your feeling was absolutely right!! :wink: :D

              It almost fits my needs except in one case. Consider this example: "MyHTMLCode".
              What I need is "My_HTML_Code" and not "My_HTMLCode".

              Anyway, I have few cases like this and can modify them manually. Current solution is pretty good.
              (of course solutions to this are welcome :wink: )

              Thanks a lot again.