Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
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.
AV
17TH AV
I also tried
Select trim(regexp_replace('17 TH AV','^[0-9]+\s+TH ',''))
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
Add a comment
You haven't told the replace function what the \1 should refer to.
\1
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.
Required, but never shown
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.
Explore related questions
See similar questions with these tags.