|
|||||||
![]() |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Jan 2022
Device: Galaxy S9+
|
Regex expression to edit series when saving books to disk not working.
Hello,
All my series have non-english characters in them and the english part is enclosed by square brackets. Example of a series name: 魔法科高校の劣等生 [Mahouka Koukou no Rettousei] I want to be able to change this using the template and only have the english part of the series name like this: Mahouka Koukou no Rettousei Towards that end I tried using this: Code:
{series:re('[^\x00-\x7F]+', '')}/{title}
Code:
{series:re('[^\x00-\x7F]+|\[|\]', '')}/{title}
Any help would be really appreciated. |
|
|
|
|
|
#2 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,598
Karma: 28548962
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
the regex runs on unicode not bytes. You want to use \uXXXX for unicode characters
|
|
|
|
| Advert | |
|
|
|
|
#3 |
|
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,240
Karma: 61360164
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Just capture each character type group and don't use that group in the replace
If you want to capture reserved symbols, they must be escaped: Code:
(\[foo, bar\]) \2 - \5 - \1 (notice that I did not use \3 or \4) |
|
|
|
|
|
#4 | ||
|
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Jan 2022
Device: Galaxy S9+
|
Quote:
Quote:
Thank you very much. Combining advice from the both of you I achieved my goal with this: Code:
{series: re([^\u0000-\u007F]+|[\u005B-\u005D]+, )}
|
||
|
|
|
![]() |
| Tags |
| regex, regex-function, template editor |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Saving books to disk | thomcuccureddu | Library Management | 0 | 03-18-2019 02:50 PM |
| Question about saving books to disk | Ispanderion | Library Management | 8 | 08-25-2018 08:20 AM |
| Saving books to disk using {author_sort} | DragonflyKing | Library Management | 5 | 09-26-2012 05:08 AM |
| Syntax for Saving Books to Disk | Sea Dubya | Calibre | 2 | 04-05-2012 03:15 AM |
| Saving to Disk Multi Auth same series | curiosity | Library Management | 2 | 05-27-2011 01:14 AM |