Tapatalk

Apply an Open & Closed Tag Over Multiple Paragraphs

Apply an Open & Closed Tag Over Multiple Paragraphs

1

    Aug 11, 2014#1

    Let's say I have 15 paragraphs of text. I need to have each begin with:

    <p>

    and end with

    </p>

    How can I do this in one command? So that, rather than selecting each paragraph and then applying, selecting and applying, selecting and applying...fifteen times, I can select all fifteen paragraphs at once, click one thing and each paragraph gets its own open AND close <p> applied?

    Thanks!

    6,685587
    Grand MasterGrand Master
    6,685587

      Aug 11, 2014#2

      After selecting the paragraphs
      • press Ctrl+R to open Replace dialog,
      • enter as search string ^([^\r\n][\s\S]*?)(\r?\n)$,
      • enter as replace string <p>\1</p>\2,
      • select option Selected text if not automatically selected,
      • check option Regular expressions,
      • select Perl and
      • press Replace All.
      This Perl regular expression replace all in selected text only can be recorded into a macro which is stored in a macro file with other often needed macros and therefore configured to be automatically loaded on startup of UltraEdit. Those macros in a macro file loaded on startup can be executed quickly via the macro list view or by their hotkeys/chords if assigned to the macros.

      Code: Select all

      InsertMode
      ColumnModeOff
      HexOff
      PerlReOn
      Find MatchCase RegExp SelectText "^([^\r\n][\s\S]*?)(\r?\n)$"
      Replace All "<p>\1</p>\2"
      Please note: The empty line below a paragraph must be really an empty line and not a blank line containing 1 or more spaces/tabs.

      Of course an UltraEdit script running same Perl regular expression replace all on selected text added to the list of scripts for quick execution can be used, too.
      Best regards from an UC/UE/UES for Windows user from Austria