[pmwiki-users] Markup expression for substring delimited by string

Dominique Faure dominique.faure at gmail.com
Tue Apr 4 03:57:19 CDT 2017


> I am looking for a markup expression which will return a substring
starting from the left up until, say, the first punctuation mark.
>

Hi,
This is rather easily done using MarkupExprPlus reg_replace feature:

(:text: Lorem ipsum dolor sit amet, ad has esse duis lucilius, platonem
reprimique eam at, et etiam augue interpretaris eos. Est odio nemore in,
dolor meliore an his. Quod praesent delicatissimi ut qui. Iusto
reprehendunt pro ea. Ad vel volutpat constituam.:)
* text: {$:text}
* processed: {(reg_replace '/^([^.,]+)[.,].*/' '$1' '{$:text}')}

=>

* text: Lorem ipsum dolor sit amet, ad has esse duis lucilius, platonem
reprimique eam at, et etiam augue interpretaris eos. Est odio nemore in,
dolor meliore an his. Quod praesent delicatissimi ut qui. Iusto
reprehendunt pro ea. Ad vel volutpat constituam.
* processed: Lorem ipsum dolor sit amet

Regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20170404/75bbada4/attachment.html>


More information about the pmwiki-users mailing list