all.
I'm querying a Postgres 9.3 database looking for a specific pattern in a field:
SELECT
 P.id, P.processo_id, PR.num_formated
FROM
 publications P
INNER JOIN processos PR ON PR.id=P.processo_id
WHERE
 --The first numeric sequence must be exact 4 digits length, so the initial \d{4}
 PR.num_formated ~ '\d{4}[\.\-\\]\d{2}\.\d{4}\.\d{1}\.\d{2}\.\d{4}'
AND
 P.id=781291700 --Just to force a specific record
where PR.num_formated is defined as "character varying(255)". After being executed, the query returns:
  P.id      P.processo_id        PR.num_formated
781291700     502707245    20190001418-14.1998.8.05.0103
My question is: Why is Postgres "ignoring" the first \d? Is there any specificity in the form it interprets the regular expressions that differ from the "traditional/regular/orthodox/whatever" way, since the same regex works perfectly in another part of my system, but using a ruby code?
Thanks in advance
Walid
 
    