View Single Post
Old 09-27-2010, 10:21 AM   #69
Manichean
Wizard
Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.
 
Manichean's Avatar
 
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
Quote:
Originally Posted by ldolse View Post
Right - I forgot about the search and replace function, haven't played with that feature. If you really want to get into back-references you should probably used named back-references - but there are different variations on how that works depending on how the python functions are called. When I get a chance to play with the search and replace feature I can give you some more details.
I'm happy with the backreferences as is. It's enough to get the job done, and if anyone needs more, there's always the Python regexp reference (by that point the reader should be able to understand it, I think).
Oh, and by all means play with that feature- chaley did a great job on that, I think.

Quote:
Originally Posted by Starson17 View Post
Isn't this entire subject a bit esoteric for the beginner? Most beginners just need to know that (John|Bill) can be used, not how the quantifiers apply to OR'd expressions. For single characters, they should just use square brackets and then apply the quantifier. As to the underlying issue, it wouldn't surprise me if different implementations of regex handle this differently.
I removed this section entirely, since Python handles the quantifiers like in sets, which should be intuitively obvious, if one is following the introduction. The different implementations don't concern us here, as this is only about regexpes in Calibre

Quote:
Originally Posted by Starson17 View Post
BTW, I refer to "|" as the "vertical bar," not "pipe" and in the regex context I've seen it formally referred to as the "alternation operator" or, more commonly, just "OR" or the "OR operator" The term "pipe" has a pretty specific meaning in *nixLand (and in WindowsLand) and it has nothing to do with alternation or OR. There could be confusion there.
I've only heard the character referenced to as a pipe, in its specific CLI meaning on *nix and Windows as well as just the character. Though I confess that may be because, to use modern parlance, "I hang with them geeks" Although personally, I don't see the possibility for confusion, I'm going to change it to "vertical bar", just to be safe.
Manichean is offline