Project

General

Profile

« Previous | Next » 

Revision 14270

schemas/util.sql: added extract_by_regexp()

View differences:

trunk/schemas/util.sql
2746 2746

  
2747 2747

  
2748 2748
--
2749
-- Name: extract_by_regexp(text, text, integer); Type: FUNCTION; Schema: util; Owner: -
2750
--
2751

  
2752
CREATE FUNCTION extract_by_regexp(pattern text, str text, group_ integer DEFAULT 1) RETURNS text
2753
    LANGUAGE sql IMMUTABLE
2754
    AS $$
2755
SELECT (regexp_matches(str, pattern))[group_]
2756
$$;
2757

  
2758

  
2759
--
2749 2760
-- Name: extract_str(text, text, text); Type: FUNCTION; Schema: util; Owner: -
2750 2761
--
2751 2762

  

Also available in: Unified diff