Return regex pattern from database search (NodeJS)

I am currently using Redis, but examples in any database (which is good with NodeJS) would be nice to make me move.

I am looking to find regex patterns from a list, providing potential matches.

I want to query my template database and ask her - "which templates will match this string?"

Example

Template Database:

(\/some\/) (\/relative\/) (\/other\/) 

Search: "/ some / relative / url /"

Return:

 (\/some\/) (\/relative\/) 

Search: "/ some / other / url /"

Return:

 (\/some\/) (\/other\/) 

So my question is: is this possible? If so, how?

0
javascript database regex
source share
2 answers

This is not possible (as far as I know) using only redis call. I suggest downloading all the regular expressions from the database and running them in javascript to find out which ones match.

+1
source share

I think there is a way. You need to process the template, which will be stored as a string, and then get them when you receive any other string from the redis repository. I just give a link to the redis-nodejs tutorial that I found - Using Redis with Nodejs .

0
source share

All Articles