View Single Post
Old 01-05-2012, 06:19 AM   #8
meme
Sigil developer
meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.
 
Posts: 1,274
Karma: 1101600
Join Date: Jan 2011
Location: UK
Device: Kindle PW, K4 NT, K3, Kobo Touch
Also take a look at the at the very good regex intro in the Calibre forum - https://www.mobileread.com/forums/sho...d.php?t=118569 which also links to the more extensive, although python specific, regex details at http://docs.python.org/library/re.html

The use of (?s) tells the expression to let '.' match everything including newlines - by default '.' matches everything except newlines. Since ? is used for different things in regex it can be a bit confusing (here with (? it means the next character(s) are flags for special handling and there are lots of them, ? after a normal character means 0 or 1 occurrences, and ? after * or + or ? means non-greedy/minimal matching). No wonder regex is confusing

I have a feeling there will be more and more questions about regex. Maybe we need a sticky at the top (even to link to the Calibre post?) or a quick help guide link in Sigil itself with examples. I guess the trouble is that everyone has their own way of using regex, and any examples can quickly become overwhelming.
meme is offline   Reply With Quote