Jedit: regular expression - how to?

1.9k Views Asked by At

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?

1

There are 1 best solutions below

3
On BEST ANSWER

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>