Reg Exp to find Number String

General questions about using TextPad

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

Post Reply
burtonfigg
Posts: 11
Joined: Wed Jun 01, 2005 6:37 pm

Reg Exp to find Number String

Post by burtonfigg »

Is it possible to use TextPad to search through a 3,000 line text document, and find lines including for example:

D[followed by a number] ICT e.g. D234 ICT

I don't need to run this search as well, but would also like to run another search for:

[number] bikes, e.g. 123 Bikes

The position of these strings is not consistent within each line of text.

One more search I'd like to do - would it be possible to run a search for:

**ride**
**decorating**
**anything**


Where there is one word between the asterisks - i.e. there is actually a string with **ride** and I'd like to be able to run a search for that string...

And ideally, it'd be useful to modify that search as well, to find text strings where there are any lines with **anything** where 'anything' can be any word, as long as it is wrapped in 2 asterisks.

The lines of text are from an SQL file export of a MySQL table.

Sorry for asking for so much.

Thanks
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

To find D followed by a number
Find what: D[0-9]+_

-------------------------------
To find a number followed by something else
Find what: _[0-9]+_

-------------------------------
To find anything surrounded by double asterisks
Find what: \*\*.*\*\*

--------------------------------
Note that in Searches above, that "_" is a space character

Use the following settings:
-----------------------------------------
[X] Regular expression
-----------------------------------------
Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
-----------------------------------------
Hope this was helpful.............good luck,
Bob
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

And to find text like D234 ICT use
D[0-9]+ ICT

To find text like 123 Bikes use
[0-9]+ Bikes

To find any of
**ride**
**decorating**
**anything**
use
\*\*(ride|decorating|anything)\*\*

To find any word wrapped in 2 asterisks use
\*\*[a-z]+\*\*

For all of these select Regular expression.

The regex with parentheses assumes you are using Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
Post Reply