I have to check String start with an alpha in PostgreSQL. I used this:
SELECT string ~ '^([a-z]|[A-Z])'
But it doesn't work with strings start with a Latin character. For ex: ücp.
In Java, I use this regex:
^([\pL]).*
I tried it with PostgreSQL but it does not work as expected.
How can I write this regex in PostgreSQL?
The POSIX character class [:alpha:]
is locale-dependent and matches Unicode letters as well.
Use
^[[:alpha:]]
See what the docs say:
Standard character class names are: alnum, alpha, blank, cntrl, digit, graph, lower, print, punct, space, upper, xdigit. These stand for the character classes defined in ctype. A locale can provide others.