<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Hi Stefan,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">You're right - it doesn't.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">I don't think there is a simple way to achieve what you are trying to do with the EPScript methods available:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><a href="https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwiki.eprints.org%2Fw%2FEPScript&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C00410c57aef148c56c9508d7473f588b%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=6WmaXySYkbA79f%2B9HbXwZUjyXB8z0EQvMVjE1gYotUw%3D&amp;reserved=0" originalSrc="https://wiki.eprints.org/w/EPScript" shash="LN6rB/PcMc/WW0z4p3zStm2hdrtKnGz+FO18FfljU+L1IYe2/razgy+keMXYlcPjC4/Vz4cTKu7jgsJdHkMvPRKhGtk4yytUj7YCzkW0KvnUCUJjoBDNFkwg7+bRQwKq0YtIfFaLI4f/VKmDCUalmLBKaFLUi2Ia/5H1TWl+F4A=">https://wiki.eprints.org/w/EPScript</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">If you look in EPrints::Script::Compiler::tokenise you'll see the different characters that EPScript expects - it doesn't include RegExps.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">You could inject a method to EPrints::Script::Compiled that returns a boolean for use in a test, or even rendered xhtml.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">I used this approach here:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><a href="https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feprintsug%2Fdimensions-badge%2Fblob%2Fmaster%2Flib%2Fplugins%2FEPrints%2FPlugin%2FScreen%2FEPrint%2FBox%2FDimensionsBadge.pm%23L11-L29&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C00410c57aef148c56c9508d7473f588b%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=umpdLUMGwG5SmWltAyEefzVfazgXF0DsYUAJMbivVmI%3D&amp;reserved=0" originalSrc="https://github.com/eprintsug/dimensions-badge/blob/master/lib/plugins/EPrints/Plugin/Screen/EPrint/Box/DimensionsBadge.pm#L11-L29" shash="DegjCPLxtI4E0zyPfOyx4N6bx6zzfALWQvmClbNaBQo8td1e/ONuPd0KmI3irIJaiww8zndHEGGkAAU/9zYS17pO0XmNr/jPBthzk6eSN17s5809aL8ogEPKy7cFFsBs86K6qsCvMpQQekgJ76PVtFKyg+2uHyv6lHRJGwMwFGs=">https://github.com/eprintsug/dimensions-badge/blob/master/lib/plugins/EPrints/Plugin/Screen/EPrint/Box/DimensionsBadge.pm#L11-L29</a>
 (documentation)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><a href="https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feprintsug%2Fdimensions-badge%2Fblob%2Fmaster%2Flib%2Fplugins%2FEPrints%2FPlugin%2FScreen%2FEPrint%2FBox%2FDimensionsBadge.pm%23L117-L149&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C00410c57aef148c56c9508d7473f588b%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=KJrng0saNTF6Lr%2BL9VeE4ROkuonSW4MTgekvvu6HG7w%3D&amp;reserved=0" originalSrc="https://github.com/eprintsug/dimensions-badge/blob/master/lib/plugins/EPrints/Plugin/Screen/EPrint/Box/DimensionsBadge.pm#L117-L149" shash="MsViGW5LEF7cPxNqRP9IrXGJUsiOmg0kfk0fjtVUu4gJF4dEur1fucHkaufxXTwDjWHYv1+rwxxq8YAX6ULB/E/SkTWaYFa3Mlydr+dKhDjqUaQNi7wUrQuq9LNoetcVJ9NiwrN6hWej9V385QlBY7um8BTs9bU5/PuoYe/dQ6M=">https://github.com/eprintsug/dimensions-badge/blob/master/lib/plugins/EPrints/Plugin/Screen/EPrint/Box/DimensionsBadge.pm#L117-L149</a>
 (method added to EPrints::Script::Compiled)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Let me know if that helps - or if you want some more explanation.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">You *<b>could</b>* inject a method that took a RegExp as a parameter - you would need to be careful about compiling the regex from this string if you do!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Cheers,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">John<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="mso-fareast-language:EN-GB">From:</span></b><span lang="EN-US" style="mso-fareast-language:EN-GB"> eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk]
<b>On Behalf Of </b>Stefan Wellsandt via Eprints-tech<br>
<b>Sent:</b> 02 October 2019 14:27<br>
<b>To:</b> eprints-tech@ecs.soton.ac.uk<br>
<b>Subject:</b> [EP-tech] Building citations based on condition with Regular Expression<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal"><span lang="EN-US">Hello,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I want to use a regular expression to assemble a part in a citation. This script (see below) throws me an error &#8211; I assume the EprintsScript does not know RegExp.
<o:p></o:p></span></p>
<p class="MsoNormal"><i><span lang="EN-US">&lt;when test=&quot;type.one_of('conference_item','editor_conference_proceeding')&quot;&gt;<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-US">&nbsp;&nbsp;&nbsp; In: Proceedings of the<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-US">&nbsp;&nbsp;&nbsp; &lt;choose&gt;<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-US">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;when test=&quot;event_title =~ \International\&quot;&gt;<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;if test=&quot;event_title&quot;&gt;&lt;print expr=&quot;event_title&quot;/&gt;&lt;/if&gt;<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-US">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/when&gt;<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-US">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;otherwise&gt;<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;if test=&quot;event_type&quot;&gt;&lt;print expr=&quot;event_type&quot;/&gt;&lt;/if&gt; on &lt;if test=&quot;event_title&quot;&gt;&lt;print expr=&quot;event_title&quot;/&gt;&lt;/if&gt;<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-US">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/otherwise&gt;<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-US">&nbsp;&nbsp;&nbsp; &lt;/choose&gt;<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-US">&nbsp; &lt;/when&gt;<o:p></o:p></span></i></p>
<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">What is the easiest way to fix this problem?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Best regards<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Stefan<o:p></o:p></span></p>
</div>
</body>
</html>