-
-
Save jeff/4b6252dd190d175b9e03 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION plv8_regexp_test(regexp text[2], subject text) RETURNS BOOLEAN AS $$ | |
return (new RegExp(regexp[0], regexp[1])).test(subject); | |
$$ LANGUAGE plv8; | |
CREATE OR REPLACE FUNCTION plv8_regexp_test(regexp text, subject text) RETURNS BOOLEAN AS $$ | |
BEGIN | |
RETURN plv8_regexp_test(ARRAY[regexp], subject); | |
END; | |
$$ LANGUAGE plpgsql; | |
SELECT id, date_added, name | |
FROM testable | |
WHERE plv8_regexp_test('^d', name); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment