SELECT regexp_matches(‘abc’,
‘[0-9]*’);
The query above returns text[] and need to check, whether it found any (i don’t care which) matches or none.
So in case above i get {""}, how can i get “boolean” value, which tells me if it matches something or nothing?
This seems not work:
SELECT regexp_matches(‘abc’, ‘[0-9]*’)
= ‘{}’;
Use the
~operator:Alternatively, you could pull out the first item like this:
Note the extra parentheses and that the array is indexed starting at 1.