02-17-2018, 02:14 PM | #31 |
♫
Posts: 660
Karma: 506380
Join Date: Aug 2010
Location: Germany
Device: Kobo Aura / PB Lux 2 / Bookeen Frontlight / Kobo Mini / Nook Color
|
I uploaded a short video.
First with Minimal Matchm then without. First search for *, then for + And * never finds anything. It's hard to read, but maybe it helps anyway: https://www.youtube.com/watch?v=hOtE...ature=youtu.be |
02-17-2018, 02:27 PM | #32 | |
Sigil Developer
Posts: 7,506
Karma: 5433350
Join Date: Nov 2009
Device: many
|
Hi DiapDealer,
I agree completely. Returning a zero-length match makes no sense here for Sigil. Any search for words that returns non-words as matches is not useful. That is why that [a-zA-Z]* regular expression makes no sense as it would return everything even those with match length 0. The right regular expression to do what the user wants is [a-zA-Z]+ which works in Sigil just as expected. KevinH Quote:
|
|
02-17-2018, 02:29 PM | #33 | |
Grand Sorcerer
Posts: 5,582
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
@WS64: Try the following: 1. Create a new epub2 book. 2. Position your cursor immediately before the x in xml in the first line and run your search in Regex mode with all search options unchecked and Down as the search direction. You should get xml as the only match unless you add a space after the asterisk, in which case you'll get a couple more matches. The search will fail if the cursor is positioned before a non-letter or if a word is highlighted in Code View. Last edited by Doitsu; 02-17-2018 at 02:36 PM. |
|
02-17-2018, 02:36 PM | #34 | |
Grand Sorcerer
Posts: 27,463
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
"Count" will never work when using a zero or more expression because Sigil does not recognize zero-length matches as matches. Never has. So it will stop after the first zero-length match encountered. And since "Count" always starts at the very beginning of a file (and not from where the cursor is placed), the first match of [a-zA-Z]* count will always be zero length. Last edited by DiapDealer; 02-17-2018 at 02:57 PM. |
|
02-17-2018, 02:49 PM | #35 | |
Grand Sorcerer
Posts: 27,463
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
Or a search for numbers that returns non-numbers as matches ... Regex purists may kick up their heels a bit, but they'll know deep down that from a practical standpoint, those kinds of (non)matches aren't useful 99 times out of 100. If you want to count occurrences of a repeating pattern in a string, or file, or files, use an expression that looks for one or more repetitions, not zero or more. |
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Search is a regex?? | drawson1 | Library Management | 4 | 12-21-2017 09:57 PM |
Regex in search problems (NOT Search&Replace; the search bar) | lairdb | Calibre | 3 | 03-15-2017 07:10 PM |
Regex Search doesn't search all files in Edit Book | GregTheGrate | Editor | 8 | 11-08-2016 12:47 AM |
Why didn't this regex work right? | mrmikel | Editor | 1 | 04-12-2014 10:04 AM |
Search & Replace doesn't work for quotes | habanr | Conversion | 11 | 04-22-2011 11:50 AM |