Kodi Community Forum
Splitting a list by regex - Printable Version

Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Scrapers (https://forum.kodi.tv/forumdisplay.php?fid=60)
--- Thread: Splitting a list by regex (/showthread.php?tid=339242)



Splitting a list by regex - programmkino - 2019-01-11

Hi everyone,

Is there a smart way to split a list like that with Regex's?
<dt>Genre</dt><dd>Fantasy | Literature | Drama</dd>

I hoped that combination would do. But the third regex is never triggered, therefore the last part is not extracted.
<RegExp input="$$1" output="\1" dest="11">
    <expression>&lt;dt&gt;Genre&lt;/dt&gt;.*?&lt;dd&gt;(.*?)&lt;/dd&gt;</expression>
</RegExp>
<RegExp input="$$11" output="&lt;genre&gt;\1&lt;/genre&gt;" dest="5+">
    <expression repeat="yes" trim="1">(.*?) \| </expression>
</RegExp>
<RegExp input="$$11" output="&lt;genre&gt;\1&lt;/genre&gt;" dest="5+">
    <expression>(.*?)</expression>
</RegExp>


Thanks.


RE: Splitting a list by regex - baldwinwin - 2019-03-14

This list?
Fantasy | Literature | Drama

you should extract text between <dd> and then just split by | to array