View Single Post
Old 01-06-2013, 09:57 AM   #29
Junior Member
snipe2004 began at the beginning.
Posts: 8
Karma: 10
Join Date: Jan 2013
Device: Pc - Linux - Calibre
Originally Posted by Turtle91 View Post
If I understand correctly you are only looking for "2012". If that is so, then there is no need for regex, just a simple search and replace. Try:
Find: 2012
Replace: Janv. 2012

if you are looking for ANY year then you can try this Regex:
Find: ([0-9]{4})
Replace: Janv. \1

I'm not sure what flavor of regex Calibre uses. You may have better luck if you check in their forum. This one is for the Sigil software.
Unfortunately, it doen'st work :

calibre, version 0.9.11
ERREUR : Echec: unknown string format

Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/gui2/dialogs/", line 125, in do_one_safe
  File "/usr/lib/calibre/calibre/gui2/dialogs/", line 290, in do_one
  File "/usr/lib/calibre/calibre/gui2/dialogs/", line 851, in do_search_replace
    setter(id, val, notify=False, commit=False)
  File "/usr/lib/calibre/calibre/library/", line 2613, in set_pubdate
    dt = parse_only_date(dt)
  File "/usr/lib/calibre/calibre/utils/", line 94, in parse_only_date
    ans = parse_date(raw, default=default, assume_utc=assume_utc)
  File "/usr/lib/calibre/calibre/utils/", line 80, in parse_date
    dt = parse(date_string, default=default, dayfirst=parse_date_day_first)
  File "/usr/lib/python2.7/dist-packages/dateutil/", line 697, in parse
    return DEFAULTPARSER.parse(timestr, **kwargs)
  File "/usr/lib/python2.7/dist-packages/dateutil/", line 303, in parse
    raise ValueError, "unknown string format"
ValueError: unknown string format
But sorry for the mistake, I'm going back to Calibre's forum.
snipe2004 is offline   Reply With Quote