improve regular expressions

lesson learnt from
https://www.dokuwiki.org/devel:plugin_programming_tips