-3

How can I find the position of a string starting from a specified index in Postgresql-9.3+

Example

find('ranranran','an',1) should output 2
find('ranranran','an',3)  => 5 
find('ranranran','an',6)  => 8
4
  • 1
    stackoverflow.com/questions/31059437/… I think this could be usefull for You. Commented Aug 8, 2016 at 19:04
  • 1
    Have you read any of the PostgreSQL documentation? Commented Aug 8, 2016 at 19:12
  • @muistooshort yes I have but there is no straight forward function. Commented Aug 9, 2016 at 18:31
  • @Patryk thanks I think that may be helpful Commented Aug 9, 2016 at 18:31

1 Answer 1

0

I had found answer to this, just want to post it.

strpos(substr('withintext',pos),'texttofind') + (pos-1)
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.