General questions about using TextPad
Moderators: AmigoJack , bbadmin , helios , Bob Hansen , MudGuard
gcotterl
Posts: 252 Joined: Wed Mar 10, 2004 8:43 pm
Location: Riverside California USA
Post
by gcotterl » Mon Jun 04, 2018 5:07 am
Is there way to find the number of times "are" occurs in this list:
are are thi
thi are are
are are are
are thi are
thi thi thi
thi thi are
are are thi
The result should be 12
ben_josephs
Posts: 2464 Joined: Sun Mar 02, 2003 9:22 pm
Post
by ben_josephs » Mon Jun 04, 2018 8:03 am
S earch | R eplace... (
<F8> ):
Fi nd what: \bare\b
Rep lace with: are
[X ] Regular e xpression
Replace A ll
The number of replacements is displyed in the status bar.
You can undo the replacement to keep your editing history in good order.
gcotterl
Posts: 252 Joined: Wed Mar 10, 2004 8:43 pm
Location: Riverside California USA
Post
by gcotterl » Mon Jun 04, 2018 2:10 pm
Thanks!
gcotterl
Posts: 252 Joined: Wed Mar 10, 2004 8:43 pm
Location: Riverside California USA
Post
by gcotterl » Wed Jun 20, 2018 7:49 pm
Is there way to find the number of times "goat" occurs in this list:
goat goat thi
thi goat goat
goat goat goat
goat thi goat
thi thi thi
thi thi goat
goat goat thi
The result should be 12
gcotterl
Posts: 252 Joined: Wed Mar 10, 2004 8:43 pm
Location: Riverside California USA
Post
by gcotterl » Wed Jun 20, 2018 8:03 pm
Yes.
It worked when the string is 'are' but not when the string is 'goat'
(The error says: "Invalid back reference: specified capturing group does not exist. The error occurred while parsing the regular expression:
'\g>>>HERE>>>oat\b'
ben_josephs
Posts: 2464 Joined: Sun Mar 02, 2003 9:22 pm
Post
by ben_josephs » Wed Jun 20, 2018 9:11 pm
Not
\goat\b
but
\bgoat\b
\b matches a word boundary. It stops are maching in, for example, claret .
gcotterl
Posts: 252 Joined: Wed Mar 10, 2004 8:43 pm
Location: Riverside California USA
Post
by gcotterl » Wed Jun 20, 2018 9:37 pm
Thank you
AmigoJack
Posts: 596 Joined: Sun Oct 30, 2016 4:28 pm
Location: グリーン ヒル ゾーン
Contact:
Post
by AmigoJack » Fri Jun 29, 2018 11:40 am
Alternatively use the "M ark all" button, which will also print in the status bar how often it matched.
ben_josephs
Posts: 2464 Joined: Sun Mar 02, 2003 9:22 pm
Post
by ben_josephs » Fri Jun 29, 2018 12:34 pm
No it doesn't. It shows how many lines were marked, not how many matches were found, despite its indicating otherwise.
AmigoJack
Posts: 596 Joined: Sun Oct 30, 2016 4:28 pm
Location: グリーン ヒル ゾーン
Contact:
Post
by AmigoJack » Mon Jul 02, 2018 2:21 pm
You are right, didn't know this. Looking into the manual (speak: help file) however it's already explained as "marks every line" instead of every "occurance". This should be fixed (status bar should also use the word "line") and enhanced (another button called "count matches").