Re: Search/Replace suggestion

"Matthieu Casanova" <[email protected]>
Newsgroups gmane.editors.jedit.user
Message-ID <[email protected]>
Hi, did you try the beanshell snippet replacement ?

Imagine you have that buffer :

Hello world 1 3
yopla 2 7


search for 

(.*) (\d+) (\d+)

and replace it with (select beanshell snippet instead of text just under the replace textarea) 

{_1 + ' ' + (Integer.valueOf(_2)+Integer.valueOf(_3));}

Maybe it could help ?

Matthieu

Lun 27 avr 2020, à 20:44, Edward Diener a écrit :
> It would really be useful if in a search/replace operation, especially 
> when using regular expressions, if the seach text found could be piped 
> as input to some executable ( command processor, shell, or script ) and 
> use the output of the executable as the replacement text. I occasionally 
> have a need to do some sort of calculation with the text that is found 
> in order to provide the replacement, which a pure textual substitution 
> can not encompass. A common example would be finding a number in the 
> search string, doing a numerical calculation with that number, and 
> having the replacement text be the result of such a calculation. While a 
> pure script, written in some language can do this, not having that sort 
> of functionality while editing with JEdit is unfortunate.
> 
> 
> 
> -- 
> -----------------------------------------------
> jEdit Users' List
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jedit-users
>


-- 
-----------------------------------------------
jEdit Users' List
[email protected]
https://lists.sourceforge.net/lists/listinfo/jedit-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.