[Evergreen-dev] Regular Expressions in print templates
Galen Charlton
gmc at equinoxoli.org
Fri Jul 16 15:45:28 EDT 2021
Hi Ben,
On Fri, Jul 16, 2021 at 9:57 AM Benjamin Kalish via Evergreen-dev <
evergreen-dev at list.evergreen-ils.org> wrote:
> I'm trying to use regular expressions in a print template, but I can't
figure out what
> is supported. replace() is clearly supported for strings, because
> {{ "catalog".replace("alog","s"); }} gives cats, but all my attempts with
regular
> expressions have failed, whether I use RegExp() or the slash notation.
>
> Is there a way to use regular expressions in print templates? They would
be oh so useful here!
Unfortunately, the AngularJS expressions that those print templates use
explicitly do not support regexp literals.
However, it would be a matter of just a few lines of code to make Evergreen
define a custom filter implementing a regexp replace function that could be
made available to the print templates, a la
https://embed.plnkr.co/plunk/8LDJXj.
Regards,
Galen
--
Galen Charlton
Implementation and IT Manager
Equinox Open Library Initiative
gmc at equinoxOLI.org
https://www.equinoxOLI.org
phone: 877-OPEN-ILS (673-6457)
direct: 770-709-5581
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.evergreen-ils.org/pipermail/evergreen-dev/attachments/20210716/6a20ff16/attachment.html>
More information about the Evergreen-dev
mailing list