Sample Header Ad - 728x90

postgres error: invalid regular expression: brackets [] not balanced

0 votes
1 answer
2802 views
On the postgres command line, I tried this: select regexp_matches('file?device_id[]=555', 'device_id\[\]=(\d+)', 'g') as dev_id; I get this error: ERROR: invalid regular expression: brackets [] not balanced When I run this same query in HeidiSQL it returns with no errors. I don't understand why the CLI thinks the brackets are unbalanced when I'm escaping them. Just for testing, I tried anywhere from 0 to 3 backslashes to escape the brackets, and none of those worked.
Asked by raphael75 (244 rep)
Dec 7, 2021, 03:16 PM
Last activity: Nov 4, 2022, 04:03 PM