Can't find character

General questions about using TextPad

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

Post Reply
gcotterl
Posts: 252
Joined: Wed Mar 10, 2004 8:43 pm
Location: Riverside California USA

Can't find character

Post by gcotterl »

To find lines with a hyphen in position 97, I type:

^.{96}-

in the 'Find What' box, tick "Regular Expression" then click "Find All" but a dialog box is displayed saying "Cannot find regular expression: '^.{96}-'

(In the Preferences Edit menu. the "Use POSIX regular expression syntax" box is ticked).

Is there something "special" about searching for a hyphen?
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

No, there isn't. Hyphen is "special" only when enclosed in square brackets.

Are you sure the character position is correct? Are you sure it's a hyphen?
gcotterl
Posts: 252
Joined: Wed Mar 10, 2004 8:43 pm
Location: Riverside California USA

Post by gcotterl »

[b][size=18]CORRECTION[/size].[/b]

To find lines with a hyphen in position 93, I type:

^.{92}-


Here are some examples of my data:

009601705-4
008514276-7
008516513-7
009701511-4
009600208-9

(The character before each hyphen is in positon 92).
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

You are using "Posix" regular expression syntax, aren't you?
gcotterl
Posts: 252
Joined: Wed Mar 10, 2004 8:43 pm
Location: Riverside California USA

Post by gcotterl »

Yes, in the Preferences Edit menu. the "Use POSIX regular expression syntax" box is ticked
gcotterl
Posts: 252
Joined: Wed Mar 10, 2004 8:43 pm
Location: Riverside California USA

Post by gcotterl »

I found the problem: At the beginning of each line, there was a tab character.

Subtracting the number of positions represented by the tab character from the number in my original regular expression resulted in successful "finds".
Post Reply