Is it possible in PostgreSQL 9.4 (PLPGSQL) to detect if a string contains a certain string including wildcards and get the wildcards, ex.:
IF NEW.my_string CONTAINS 'patternXYZ' THEN
NEW.my_values := getXYZ(my_string)
END IF;
Which would result in NEW.my_values to contain XYZ (which can be anything in the string, but only the 3 characters).
SELECT
CASE
WHEN (NEW.my_string like '%patternXYZ%')
THEN substring(NEW.my_string from '+pattern+')
ELSE '00'
END AS data
FROM my_table;
Pattern should be the parameter for query.