22147Re: [Clip] A little help on look behinds
- Oct 6, 2011Hi John:
This appears to work from Replace dialog - or in a clip
Note - the \K throws away everything before it (ie. beginning of buffer
thru any length string of characters NOT containing and "[" then
matches the first [[[[ and remainder up to first linefeed. This gets
around the normal lookbehind requirement that it be of fixed length.
Note - another way to do would be match both parts but discard the
second (replacing both by just the first) (not tested)
Regards ... Alec (buralex@gmail & WinLiveMess - alec.m.burgess@skype)
On 2011-10-06 23:01, John Shotsky wrote:
> I always have trouble making these things work.
> I enclose groups of text with [[[[group of text]]]] with up to thousands of instances. The very first one may be missing
> the [[[ part. That's the only one.
> I want to delete the ]]] that is not preceded by a [[[ + a group of text that exists. It can always be found as
> happening after the start of the file (/A) and before any [[[. I apparently don't know how to apply multiline to a look
> behind to detect this situation.
> An example:
> This is the first line in the file.
> This is the second line in the file.
> ]]] this is the line I want removed.
> [[[ this is a valid line
> any number of lines here are valid lines
> ]]] this is a valid line.
> The only one to remove is the first one.
> Any ideas? This has me stumped. I know how to do it the hard way, by permitting sentences that don't start with ] after
> the file beginning, but I know there is a better way. Besides, I don't always know how many lines may exist between the
> top of the file and the first ]]] that is not preceded by a [[[.
- << Previous post in topic Next post in topic >>