View Single Post
Old 04-13-2016, 10:35 PM   #15
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,819
Karma: 28586150
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by fidvo View Post
This will work in cases where there's only one division (space-slash-space) in each tag. Maybe someone smarter than me can figure out how to fix it so it works for an arbitrary number of divisions.
That is all that is needed. Tag mapper rules apply repeatedly to their own output (upto a hard limit of twenty times)

So the solution is simple:
pattern: ([^/]+) / ([^/]+)
replace: \1, \2

This will cause: a / b / c /d
to become: a, b, c, d

The only case it does not handle is leading and trailing slashes, which I leave as an exercise for the reader.

I might look into adding a separate split action in addition to replace, which will make this particular class of operations more intuitive.
kovidgoyal is offline   Reply With Quote