Match Odd Numbers

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
jeff.roller
Posts: 4
Joined: Wed Oct 31, 2007 3:25 pm

Match Odd Numbers

Post by jeff.roller »

I need to find matching odd page numbers within a line of text like this:

Code: Select all

XXXRSZ    Printed:   Run:  05:00 PM  06/14/2011     Page:    13 of     13     Info:      000111030001
OR

Code: Select all

HRDDFF    Printed:   Run:  05:10 PM  06/14/2011     Page:    9  of     9      Info:      088319391101
- it will always start with

Code: Select all

Page:
- next 7 characters will be whitespace with an odd number
- next will be

Code: Select all

of
- next 12 characters will be whitespace with a matching odd number

Any help is appreciated! Thanks. -jeff
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Use "Posix" regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
Search | Find... (<F5>):
Find what: Page: +([0-9]*[13579]) +of +\1 +

[X] Regular expression
jeff.roller
Posts: 4
Joined: Wed Oct 31, 2007 3:25 pm

Thank you!

Post by jeff.roller »

Works perfectly!

What is the difference between regular expression and POSIX?
jeff
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

TextPad uses the term "Posix" to distinguish between two styles of syntax for regular expressions. See TextPad's help under
How to... | Find and Replace Text | Use Regular Expressions.

The term "Posix" is a misnomer here: the Posix standard defines two syntax styles and semantics of regular expressions -- basic and extended. The setting in TextPad affects the syntax only; it doesn't affect the expressive power of TextPad's regular expressions (which is weak by current standards).

The syntax style that TextPad calls "Posix" tends to produce more readable regular expressions.
Post Reply