Regular expression: specifying line length

General questions about using TextPad

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

Post Reply
miraclemaker
Posts: 2
Joined: Tue Jul 22, 2003 11:04 am

Regular expression: specifying line length

Post by miraclemaker »

Hi, I'm trying to define a regular expression that will match entire lines that are below a certain length. I know how to specify that a whole line must be matched, and that the line can contain any characters, but I'm having trouble with spcifying the length part - can anyone help?

Thanks.
bveldkamp

Post by bveldkamp »

This will select lines having 15 or less characters (leave out the slashes if you have posix RE syntax enabled):
^.\{0,15\}$

Berend
miraclemaker
Posts: 2
Joined: Tue Jul 22, 2003 11:04 am

Post by miraclemaker »

That's great - thanks!

I was getting close - this is as far as I got:
^\(.\{0,5\}\)$
Post Reply