Re: Search/Replace suggestion
Edward Diener <[email protected]>
| Newsgroups | gmane.editors.jedit.user |
|---|---|
| Message-ID | <[email protected]> |
On 4/27/2020 2:59 PM, Matthieu Casanova wrote:
> 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 ?
That is superb. I never noticed that replacement option ! I just have to
learn to write beanshell code, but that should not be too hard. Thanks !
>
> 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