Quote:
Originally Posted by Manichean
See here. The word you're looking for is "named backreferences". It was explained in the tutorial passing back when the tutorial still contained how to add books, I may have to write a paragraph about backreferences to add.
|
thanks , I understand it now. inclusion within calibre tutorial , or as a specific link from the add books preferences page would be good.
this is the info that I was missing beforehand ( taken from your link):
(?P<name>...)
Similar to regular parentheses, but the substring matched by the group is accessible within the rest of the regular expression via the symbolic group name name. Group names must be valid Python identifiers, and each group name must be defined only once within a regular expression. A symbolic group is also a numbered group, just as if the group were not named. So the group named id in the example below can also be referenced as the numbered group 1.
For example, if the pattern is (?P<id>[a-zA-Z_]\w*), the group can be referenced by its name in arguments to methods of match objects, such as m.group('id') or m.end('id'), and also by name in the regular expression itself (using (?P=id)) and replacement text given to .sub() (using \g<id>).