Page 1 of 1

[Solved] Regular expression for paragraph start

Posted: Fri Mar 01, 2024 1:35 am
by jacksparrowjive
I need to add a specific notation to the beginning of every new paragraph(the exact same one for every paragraph). Is there a regular expression or I can search for representing a new paragraph, that I can then insert my notation to be added? Thanks!

Re: Regular expression for start of new paragraph?

Posted: Fri Mar 01, 2024 3:03 am
by robleyd
From the HELP for regular expressions:
^
Only finds the search term if the term is at the beginning of a paragraph. Special objects such as empty fields or character-anchored frames, at the beginning of a paragraph are ignored. Example: "^Peter".
Note; this will also find text in footers and headers!

As you want to add something to the beginning of existing paragraphs your Find string would be

Code: Select all

(^.)
and your Replace string would be

Code: Select all

a specific notation $1
Obviously, replace a specific notation with the actual text required

Re: Regular expression for start of new paragraph?

Posted: Fri Mar 01, 2024 3:24 am
by JeJe
If you mean an empty paragraph, find with,
^$
For the replace for an empty paragraph, whatever you want followed by \n
Whatever\n

A different method than already suggested for a non-empty paragraph is
.*
For the replace, add whatever to the front by following with & (& keeps the original text)
whatever&