5

It have source code that contains sections like this:

<pre>  text
</pre>

long long text

<pre>  text
</pre>

long long text

I have to find this entry

<pre>  text
</pre>

in JEdit and replace it with space. (I read the regex rules in the JEdit documentation.)

My expression is:

<pre>([\.\n]*?)</pre>

But it couldn't find the entry.

What expression should be correct?

Tsundoku
  • 2,455
  • 1
  • 19
  • 31
Anthony
  • 3,218
  • 3
  • 43
  • 73

1 Answers1

3

In your regex the . is being treated literally and not as a meta-character to match any character except newline.

Try:

<pre>(.|\n)*?</pre>

Since the OS is not specified, a newline can be represented by either a \n (Unixes) or a \r\n (windows). In either case you can use:

<pre>(.|\r?\n)*?</pre>
codaddict
  • 445,704
  • 82
  • 492
  • 529