Search Postgresql Archives

Validating user-input to be inserted in regular expressions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I would like to take user input, which should be interpreted literally, and
put it inside a regular expression, something like

select * from files where path ~ (USER_INPUT || '.*')

How should I escape the user input? I mean: I know that I must insert double
backslashes before special characters (in the sense of regular expressions)
but how to know what these special characters are? Should I find every
possible character in the documentation for regular expressions? Is there a
safer way?

Thanks

Vincenzo Ciancia

-- 
Please note that I do not read the e-mail address used in the from field but
I read vincenzo_ml at yahoo dot it
Attenzione: non leggo l'indirizzo di posta usato nel campo from, ma leggo
vincenzo_ml at yahoo dot it


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@xxxxxxxxxxxxxx)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux