Find and replace before and after selection

Find and replace before and after selection

5
NewbieNewbie
5

    May 05, 2006#1

    I'm trying to create a find and replace macro to easily add html tags to the beginng and end of selected text.

    I'm new to UE and normally use TextMate.

    Lets say I select any word I want to bold in html.

    I would like to have a macro add the <b> before and </b> after selected text.

    In the find and replace I selected regular expressions and selected text.

    How could I have ^ find before the selection and add <b> before the selection.

    Likewise I would like $ to add a </b> at the end of the selection.

    Ideas anyone?

    206
    MasterMaster
    206

      May 06, 2006#2

      Read about Tag Lists in the help. The Tag List view can be opened with View - Views/Lists - Tag List.

      5
      NewbieNewbie
      5

        May 06, 2006#3

        Thanks for the help. I'm new to this application and its so much more powerful than anything else I've used so far. Also noticed that ^ in the regular expressions for beginning of line is actually % in UE.

        Thanks again you answered my question. Also wish I checked that help file before asking :(

        206
        MasterMaster
        206

          May 06, 2006#4

          There are three types of regular expressions available - UltraEdit, Unix, and Perl. There are some differences in the syntax that you have to be aware of.

          Sometimes it's hard to know where to look in a big Help file if you don't get a bit of guidance first.

          5
          NewbieNewbie
          5

            May 06, 2006#5

            Actually I'm having tons of problems.

            All I want to do is create a simple macro that puts a html tag before and after a selection, but can't seem to get it to find the beginning of a selection and then the end of a selection for the final result.

            <tag>selected text</tag>

            Its far easier to hit a macro then to go into a tag menu for every little tag when you repeat it over the course of a large document.

            How can I write a find and replace script that will do what I want?

            206
            MasterMaster
            206

              May 06, 2006#6

              Try this for bold.

              InsertMode
              Cut
              "<b>"
              Paste
              "</b>"

              5
              NewbieNewbie
              5

                May 06, 2006#7

                It works, thank you so much for the advice. I don't know why it works, but now I can get crazy with my macros.

                  May 06, 2006#8

                  I see it was just a simple recoding of typing in the tag and cuting my html into and pasting it in between.

                  Wish I thought of that :D

                  6,686585
                  Grand MasterGrand Master
                  6,686585

                    May 07, 2006#9

                    For such simple tasks I use templates. For your example, the template would be <b>[$replace$]</b>

                    See also Usage of ^c and ^s in search and replace.