1

I want to recognize TIMESTAMP in PostgreSQL by using regexp:

SELECT substring('13:14:00', '([0-1][0-9]|2[0-3]):[0-5]\d:[0-5]\d')

This query returns 13, but I need to receive result 13:14:00.

Analogical query SELECT substring('134', '1(2|3)4') returns 3 instead of 134.

So, what is the problem? My psql version is 9.3.1.

1 Answer 1

2

Add parenthesis:

  SELECT substring('13:14:00', '(([0-1][0-9]|2[0-3]):[0-5]\d:[0-5]\d)');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.