multiline regex

Ideas for new features

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
leegold
Posts: 65
Joined: Sat May 03, 2003 1:16 am
Location: USA

multiline regex

Post by leegold »

Just realized there's no multiline regex in Textpad. That should be fixed ASAP IMHO.
polebridge
Posts: 8
Joined: Thu Jun 03, 2010 12:21 pm
Location: A2, Mi, US

Post by polebridge »

Do you mean a regex that will match across a newline? try \n

abc
def
abc
ghi

so "abc\ndef" will match line 1-2, but not 3-4
and "abc\n.*\nab" will match line 1, 2, and part of 3

Or do i misunderstand your issue?
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

If you need to match a fixed number of newlines you can use \n.

But TextPad's regex engine doesn't allow a \n to be quantified with a * or +, or to be contained in a parenthesised expression. So you can't match an arbitrary number of newlines.
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

ben_josephs wrote:If you need to match a fixed number of newlines you can use \n.

But TextPad's regex engine doesn't allow a \n to be quantified with a * or +, or to be contained in a parenthesised expression. So you can't match an arbitrary number of newlines.
And backreferences do not work across lines as well.
polebridge
Posts: 8
Joined: Thu Jun 03, 2010 12:21 pm
Location: A2, Mi, US

Post by polebridge »

Hi ben and Mud,

"parenthesized" and "backreferences"

I ran into those issues this morning, came here to edit my post, but found you guys were all over it. Thanks!
Post Reply