[Evergreen-dev] Regular Expressions in print templates

Benjamin Kalish bkalish at forbeslibrary.org
Wed Jul 21 14:53:19 EDT 2021


Thanks, Galen,

How would I get a custom filter like this into a template?

Benjamin Kalish
Forbes Library / 413-587-1012 / bkalish at forbeslibrary.org

Support Forbes Library:

   - Consider giving a gift
   <https://forbeslibrary.org/giving/donate-online/> to Forbes Library
   - Vote for the Friends of Forbes in the Florence Bank Community Grant
   Program <https://www.florencebank.com/vote>.
   - Join the Friends of Forbes today <https://forbeslibrary.org/friends/>!

Currently reading:* The Sellout *by Paul Beatty
Just Finished: *First Person Singular* by Haruki Murakami

For information about accessibility at the library, please see:
http://forbeslibrary.org/accessibility/


On Fri, Jul 16, 2021 at 3:45 PM Galen Charlton <gmc at equinoxoli.org> wrote:

> 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/20210721/b18e12cc/attachment-0001.html>


More information about the Evergreen-dev mailing list