Page 1 of 1

Match Odd Numbers

Posted: Mon Jul 18, 2011 2:19 pm
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

Posted: Mon Jul 18, 2011 3:38 pm
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

Thank you!

Posted: Mon Jul 18, 2011 4:03 pm
by jeff.roller
Works perfectly!

What is the difference between regular expression and POSIX?

Posted: Mon Jul 18, 2011 7:56 pm
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.