File: regexp.sql

package info (click to toggle)
pg-gvm 22.6.11-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 416 kB
  • sloc: ansic: 574; sql: 201; sh: 30; makefile: 12
file content (14 lines) | stat: -rw-r--r-- 453 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
-- Start transaction and plan the tests.
BEGIN;

-- IMPORTANT! See https://pgtap.org/documentation.html#iloveitwhenaplancomestogether
SELECT plan(3);

-- Run the tests.
SELECT ok(regexp ('abc', '^[a-z]+$'), 'Should match!');
SELECT is(regexp ('123', '^[a-z]+$'), false, 'Should not match');
SELECT is(regexp ('123', '^[a-z+$'), false, 'Should return false because regex is invalid');

-- Finish the tests and clean up.
SELECT * FROM finish();
ROLLBACK;