05-17-2018, 04:26 AM | #1 |
Groupie
Posts: 171
Karma: 40000
Join Date: Oct 2013
Device: kindle
|
[BUG] Index lists all words starting with string
Sorry for the obscure title. I just discovered a bug, not sure if it's specific to the latest version or if it was there already.
The index creator lists all the instances of words that start with the "text to include", as opposed to what it should do, that is listing only the instances of that specific string on its own. That is, if I add an index entry with "text to include" just the letter "a", the index lists all the occurrences of words that start with "a", whereas it should only list the occurrences of word that are exactly a. Hope I was clear. Also, I'd like to know if the index is case-sensitive. |
05-17-2018, 10:22 AM | #2 |
Sigil Developer
Posts: 8,115
Karma: 5450818
Join Date: Nov 2009
Device: many
|
No, it is not a bug. It is working as designed. The "Text to include" is a pattern (ie regex). Please see the Sigil User Manual about using the Index Editor.
One possible pattern to look for the single character word "a" might be the following: \sa\s where the \s indicates any amount of whitespace |
Advert | |
|
05-17-2018, 10:25 AM | #3 |
Groupie
Posts: 171
Karma: 40000
Join Date: Oct 2013
Device: kindle
|
Aha ok. I had thought about the whitespace, but then it would miss the instances where the word is followed by punctuation, right?
|
05-17-2018, 10:27 AM | #4 | |
Wizard
Posts: 2,303
Karma: 12126963
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
Quote:
Code:
\ba\b You can read about it on Regular-Expressions.info's page on Word Boundaries. |
|
05-17-2018, 10:38 AM | #5 |
Groupie
Posts: 171
Karma: 40000
Join Date: Oct 2013
Device: kindle
|
Thank you. I just tried it and it almost works: it unfortunately matches accented letters as if they were word boundaries:
Code:
\ba\b |
Advert | |
|
05-17-2018, 10:44 AM | #6 |
Sigil Developer
Posts: 8,115
Karma: 5450818
Join Date: Nov 2009
Device: many
|
You could try:
[\s'"]a[\s."'!:;] or whatever set of punctuation marks you want. Last edited by KevinH; 05-17-2018 at 10:46 AM. |
05-17-2018, 10:46 AM | #7 |
Groupie
Posts: 171
Karma: 40000
Join Date: Oct 2013
Device: kindle
|
Thank you, that seems to do the trick, even though I was hoping for something more direct, to match any non-letter string.
|
05-17-2018, 11:01 AM | #8 |
Sigil Developer
Posts: 8,115
Karma: 5450818
Join Date: Nov 2009
Device: many
|
Using regex is about the only way to generate a controlled list of words to index. A more precise way to is manually mark each word to be included in the index.
Sometimes for complicated index entries I use Find/Replace in regex mode and then manually mark the ones I actually want in the index as opposed to minor references. I do this as a final step while proofing a near final document. You can also right click in the Index Editor and open a tab separated "word" list (really pattern list) and build the list of patterns that way. As I read/proof I sometimes simply add text patterns for words I want indexed to an open text editing window instead of marking them directly. |
05-17-2018, 12:03 PM | #9 | |
Grand Sorcerer
Posts: 27,989
Karma: 199001268
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
Instead of merely: Code:
\ba\b Code:
(*UCP)\ba\b Last edited by DiapDealer; 05-17-2018 at 12:06 PM. |
|
05-17-2018, 01:28 PM | #10 |
Groupie
Posts: 171
Karma: 40000
Join Date: Oct 2013
Device: kindle
|
It works! Thank you.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Reader HTML/CSS bug lists | nabsltd | Which one should I buy? | 3 | 07-20-2017 05:51 AM |
Setting another series starting index | RotAnal | Library Management | 8 | 03-06-2017 09:21 AM |
Formatting bug in iPad KIndle App - ordered lists | Oxford-eBooks | Kindle Formats | 7 | 11-30-2015 06:09 AM |
string index out of range when setting foldename | jomaweb | Calibre | 13 | 05-23-2010 04:49 AM |