I
I
ITamateur2020-01-22 18:50:16
PostgreSQL
ITamateur, 2020-01-22 18:50:16

Why is the question mark not escaped?

Hey!
I use substring to get a substring.
The initial line of the form: /profile/username?from
I need to get username, at the beginning there will always be /profile/ and after username there is always a question mark.
I write the query:
select substring('/profile/username?from' from '/profile/#"_*#"\?' for '#')
And I get in response:
username?from
The question mark is simply ignored. If we add f:
select substring('/profile/username?from' from '/profile/#"_*#"\?f%' for '#')
then it will be: username?
What am I doing wrong?)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2020-01-22
@ITamateur

select substring('/profile/username?from' from '/profile/(.*)\?');
select substring('/profile/username?from' from '/profile/(.*)[?]');
select substring('/profile/username?from' from '/profile/([^?]*)');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question