Quote:
Originally Posted by ilovejedd
I'm trying to extract the filename (in Calibre for Windows) of a book.
Caveat, it doesn't want to accept backslash as separator? Help, please.
Code:
{:'sublist(select(formats_paths(),"MOBI"),-1,0,"\\")'}
|
Clearly the lexical analyser is broken. That doesn't really surprise me, given I used regexps to parse strings.
The problem is that the \" is recognized before the \\. This formulation gets rid of the \" by using a character class to change the backslashes into colons, so the problem goes away.
Code:
{:'sublist(re(select(formats_paths(),"MOBI"), '[\\]', ':'), -1,0,":")'}
This formulation gets rid of the sublist, depending on greedy regular expressions
Code:
{:'re(select(formats_paths(),"MOBI"), '.*[\\]', '')'}