Re: [code] Matching new lines

From: Mitchell <m.att.foicica.com>
Date: Tue, 26 May 2020 12:30:01 -0400 (EDT)

Hi James,

On Tue, 26 May 2020, James Reynolds wrote:

> The documentation says: "Note that Textadept’s editing component, Scintilla, does not allow for matching newline characters (\r and \n). Use Lua scripts and Lua patterns instead."
>
> https://foicica.com/textadept/manual.html#Regular.Expressions
>
> I'm familiar with grep but I'm new to Lua Patterns. I've looked at them and they look like grep but I am unsure what Lua Pattern I would use to match \r or \n. And does this mean I would have to write a Lua script to match newlines or can I use Lua Patterns in the find and replace fields?

You would write a Lua script that fetches text (e.g. via `buffer:get_text()`) and searches within it for newlines (e.g. `text:find('something\r?\n')`). The wiki has a module that allows you to toggle between regex and Lua patterns for the Find & Replace pane, but you cannot use Lua patterns in that pane by default.

Cheers,
Mitchell

-- 
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 Tue 26 May 2020 - 12:30:01 EDT

This archive was generated by hypermail 2.2.0 : Wed 27 May 2020 - 06:54:27 EDT