George Nth
George Nth
George Nth
George Nth
William IV
Victoria
Edward VII
George Nth
Edward VIII
George Nth
Elizabeth

But I would think just using the search/replace dialog would be easier: Search > Replace

Find What :Gregory\x20+\w+,

Replace With :George Nth

☑Regular Expression (checked)

☐. matches newline (unchecked)

Replace All

… but maybe there was a portion of your requirements that you didn’t include, that requires you bookmark multiple lines through multiple confusing matches before you do one solid replace.

Notice, both of these replace all the originally matched data – either the bookmarked lines, or the matched text – with the George Nth: if you really want to replace each bookmarked line with something different, neither of these strategies will work for you. (Your use of the plural in “translated lines” makes me think you want something different for each line)

It might be a good idea for you to more clearly define what you’re trying to achieve, with better example texts, and showing both “before” and “after” conditions… Embedding the text, so we can copy your actual text, is helpful. This FAQ shows some ways to embed text, and to embed the image so that it shows up in the post, rather than requiring us to click to another site.

The last Peter's post, speaking about the command Search > Bookmark > Paste To (Replace) Bookmarked Lines helped me to think of a true advantage of this command. Indeed, let’s suppose we would like to search a great amount of text and replace it with, a great amount of text, too !

As you probably know, the Find what: and Replace with: zones cannot contain more than 2046 characters

Regarding the Find what: field, you can, generally, consider any reasonable amount of text, while using regular expressions, by two means :

Using the generic regexes (?s-i)Beginning mark.+?Ending Mark Included or (?s-i)Beginning mark.+?(?=Ending Mark Excluded)

For instance, in the N++ license.txt file, using the Regular expression search mode, the regex (?s-i)TERMS AND CONDITIONS.+?(?=NO WARRANTY) will select all the TERMS AND CONDITIONS paragraph, with its 11 points !

Using the generic regex (?s-i)(\QMark\E).+?\1\R, where Mark represents any odd string

For instance, in the text, below, the part, which will be deleted or replaced, is delimited by the two specific strings ##**## and is matched with the regex (?s-i)(\Q##**##\E).+?\1\R

Of course, we, just, can copy some static text in the clipboard and you cannot benefit, for instance, of the \# syntax, which allow us to rewrite the group #, in replacement. But, all in all , it’s a nice work-around ;-))

…the command…“Paste To (Replace) Bookmarked Lines” helped me to think of a true advantage of this command. Indeed, let’s suppose we would like to search a great amount of text and replace it with, a great amount of text…

When Marking (with bookmarking hits enabled) finds a match that spans lines, it will only bookmark the FIRST line of the match, so this technique may not allow full replacement of “a great amount of text” searched for.

…the command…“Paste To (Replace) Bookmarked Lines” helped me to think of a true advantage of this command. Indeed, let’s suppose we would like to search a great amount of text and replace it with, a great amount of text…

When Marking (with bookmarking hits enabled) finds a match that spans lines, it will only bookmark the FIRST line of the match, so this technique may not allow full replacement of “a great amount of text” searched for.

Arrrrgh, sorry, I’m really confused ! I confess that, when elaborating my previous post, I just verified that my regexes were correct, but, without even doing a mark test :-(( I would, certainly, have noticed that well-known fact !

However, the search regexes, of my previous post, are still reliable when a great amount of text must be simply replaced by the contents of the Replace area :-))

On the other hand, if your regex identifies some specific lines in the scanned file(s), the Search > Bookmark > Paste to (Replace) Bookmarked Lines command allow you to replace each of those specific lines with the clipboard contents, which may have a consequent size !

Now, even if the Mark feature would have marked all the lines, matched in a Multi-lines search, the Search > Bookmark > Paste to (Replace) Bookmarked Lines command would have been useless, as every line marked would have been replaced with the clipboard contents ! Not the expected result, isn’t it !!

But I’ve got an easy solution !! Don’t you see ?..

Well, regarding the different areas of text, whatever their reasonable size, which will be replaced, each, by the clipboard contents :

Insert a line, with a Start Mark, before these areas of text

Insert a line, with a Stop Markafter these areas of text

Now, perform the following global replacement :

SEARCH (?s)^\QStart Mark\E.+?(?=^\QStop Mark\E)

REPLACE Leave EMPTY

=> After replacement, the area(s) of text is/are deleted and it just remains one/several line(s) Stop Mark, which will be replaced by the clipboard contents. Now, everything is clear :

First, put the replaced text, whatever its size, in the clipboard

Open the Mark panel

Enter the simple search regex \QStop Mark\E

Tick the Bookmark line option and, may be, the Purge for each search option

=> Every line Strop Mark will be replaced with the clipboard contents ;-))

You are done !

Remarks :

If your marks do not contain any special regex character, you can omit the \Q and \Eescape sequences

Your marks can, also, be any simple character, assuming that your text does not contain this character at column 1. For instance, if your Start Mark and Stop Mark are, respectively, the # and the @ symbols, just use the regex S/R :