1

Can some one please help me with this:

Select trim(regexp_replace('17 TH AV','^[0-9]+\s+TH ','\1 '))

is giving me AV.The output should be 17TH AV.

I also tried

Select trim(regexp_replace('17 TH AV','^[0-9]+\s+TH ',''))

2 Answers 2

1
Select trim(regexp_replace('17 TH AV','^([0-9]+)\s+','\1'))

This should do it for you.See demo.

https://regex101.com/r/nD5jY4/7

Sign up to request clarification or add additional context in comments.

Comments

1

You haven't told the replace function what the \1 should refer to.

Select trim(regexp_replace('17 TH AV','^([0-9]+)\s+TH ','\1TH '))

This way you tell it with the parentheses to grab the numbers that are followed by space and TH and remove the space.

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.