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.
dev_id {555}for me!psql