Matching line numbers

General questions about using TextPad

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

Post Reply
User avatar
SteveH
Posts: 327
Joined: Thu Apr 03, 2003 11:37 am
Location: Edinburgh, Scotland
Contact:

Matching line numbers

Post by SteveH »

Is there a nice, elegant regular expression that matches all the following line numbers. They all start as the first character on a new line and the one without the 'E have a space in front of them.

Code: Select all

 000000
     25
     30
    100
 500000
E700000
 999999
Running TextPad 5.4 on Windows XP SP3 and on OS X 10.7 under VMWare or Crossover.
ben_josephs
Posts: 2459
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Is this what you need?
Find what: ^( +|E)[0-9]+

[X] Regular expression
It assumes you are using Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
User avatar
SteveH
Posts: 327
Joined: Thu Apr 03, 2003 11:37 am
Location: Edinburgh, Scotland
Contact:

Post by SteveH »

It assumes you are using Posix regular expression syntax
Thanks Ben, that works great as always.

In this case it's something closer to PCRE.
Running TextPad 5.4 on Windows XP SP3 and on OS X 10.7 under VMWare or Crossover.
User avatar
Bob Hansen
Posts: 1517
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Here is another solution also:

Search for: ^.{7}
Hope this was helpful.............good luck,
Bob
User avatar
SteveH
Posts: 327
Joined: Thu Apr 03, 2003 11:37 am
Location: Edinburgh, Scotland
Contact:

Post by SteveH »

Thanks Bob. That would also match the first 7 characters of comments, which can also occupy the same space as statement numbers. I didn't say that though, so your suggestion would work on the example I provided.
Running TextPad 5.4 on Windows XP SP3 and on OS X 10.7 under VMWare or Crossover.
Post Reply