2

I have to write a HSQLDB query that splits this string on '/'

/2225/golf drive/#305/Huntsville/AL/1243

This is where I am at

select REGEXP_SUBSTRING_ARRAY(Terms, ''/[a-zA-Z0-9]*'') as ARR from Address

This is giving me

/2225, /golf, /, /Huntsville, /AL, /1243 - (Missing "#305" and "drive" in second split)

How can I modify the regex such that it includes everything after "/" and give me this result

/2225, /golf drive, /#305, /Huntsville, /AL, /1243

1 Answer 1

4

In this case why can't you use /[a-zA-Z0-9, #]* regexp? It seems good for your goal.

I've checked, it works here for me: https://regex101.com/r/8bJQEk/1

PS This regexp /\/([^\/]*)/g can helps to split everything. Be careful with slashes). Example

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

3 Comments

But this only works with #. I can get any special character in the string
@keanu If you want to split anything you can use it /([^/]*) regexp. It works here
Simple and elegant. Thanks Denniselite

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.