[code] Find panel, $ ^ Regexp

From: David Reimer <djreimer.att.gmail.com>
Date: Sun, 11 Dec 2016 17:14:42 +0000

I think there is a solution to Olivier's regex scenario.

To add characters at the end of a "line" (= paragraph?) in TextAdept 9:

1. Make sure "Regex" is checked;
2. In "Find" put `(.)$`
3. In "Replace" put `\1newstring`
4. Click "Replace all".

Explanation uses Markdown backticks to demarcate raw text.

In "Find": the `(.)$` finds any character as last character at EOL.
The parentheses save that character for back-reference.

In "Replace": the `\1` recalls the character saved in parentheses from
the find and incudes it; `newstring` is the text you wish to add at
the EOL.

Works very nicely! Of course, it does *not* add the `newstring` in
"empty lines/paragraphs". I'm still trying to work out a way to find
and manipulate the `^$` -- if there is a workaround to this "TRE
limitation". (Do I understand its doc rightly, that `REG_NEWLINE` can
be compiled to overcome this?
<http://laurikari.net/tre/documentation/regcomp/> I might be
mistaken.)

Hope this helps!

David

> ---------- Forwarded message ----------
> From: "Olivier Guibé" <olivier.guibe.att.univ-rouen.fr>
> To: code.att.foicica.com
> Date: Thu, 8 Dec 2016 14:35:48 +0100
> Subject: [code] Find panel, $ ^ Regexp
>
> Dear all
>
> With Textadept 9.0, I tried to add to each end of line
> some characters.
> Under Emacs, the usual way is replace-regexp
> with : search $, replace "the character".
> No doubt that Textadept is able to do the same,
> but with the find/replace panel and by selecting the Regex option
> I have 0 replacement. I put $ with Search field, and b in Replace by.
>
> Is it a normal behavior ? If it is what is the (short) solution ?
>
> Regards
> O.G.

-- 
David Reimer
Edinburgh, UK
-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Sun 11 Dec 2016 - 12:14:42 EST

This archive was generated by hypermail 2.2.0 : Mon 12 Dec 2016 - 06:26:58 EST