Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - credmond

Pages: [1]
1
PSOUG / REGEXP_SUBSTR Function usage
« on: August 10, 2011, 01:32:37 PM »
I am attempting to extract substrings out of a string (ex. '001.069012...3301').
From the sting I wish to treat the period (.) as the delimiter. As such there are 5 substrings in this string with the third and fourth having a null value. I am currently using the following code to do this:

REGEXP_SUBSTR( ALS.CONCATENATED_SEGMENTS, '[^.]+', 1, 1 ) SUBST_1

This code (which I got off of this wesite, Thanks Mike!) works great as long as there are no empty (null) substrings in the string.
Right now in order to get the 5th substring, I am actually using 3 for the occurance arguement.

Any suggestions on how to get this to work so it can handle empty (null) substrings?

Side note: for those of you familiar with MUMPS, this would work like the $PIECE function.

Thank you for a great website Mike. You have lots of great content here! :-)

Pages: [1]