Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jedit: regular expression - how to?

Tags:

regex

jedit

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?

like image 409
Anthony Avatar asked Oct 24 '22 16:10

Anthony


1 Answers

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>
like image 185
codaddict Avatar answered Nov 02 '22 08:11

codaddict