U
U
user_of_toster2020-12-01 18:36:00
PostgreSQL
user_of_toster, 2020-12-01 18:36:00

How to get TRUE only in case of complete match of regular expression?

`1111234325` ~ '\d' returns TRUE if there is at least one digit on the left side of the string

How can I make `1111234325` ~ (reg) return TRUE only if the string matches the regular expression completely, not partially? Ie

`1111234325` ~ '\d' -- FALSE
`1111234325` ~ '\d*' -- TRUE

How to wrap the regular expression for this behavior?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2020-12-01
@user_of_toster

Specify the beginning and end of a string'/^\d$/'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question