on 2010 Jan 20 1:15 PM
Hi all,
using SA 11.0.1.2299, I'm having troubles with the regexp_substr() function when used with a starting offset and a pattern including the "start of string" marker (i.e. the caret sign).
Example:
select regexp_substr('a234abcd', '^[[:alpha:]]+', 1)
-> returns 'a'
select regexp_substr('a234abcd', '^[[:alpha:]]+', 5)
-> should return 'abcd' IMHO, but returns null
I would expect the "start of line" marker to apply to the offset, i.e. I would expect that the 2nd example would look for a pattern starting with offset 5.
But that doesn't seem to be the case.
Anyone to confirm this behaviour?
Addition: Would this mean if I want to check for a string that starts with a certain pattern at a particular offset, I would not use the start-offset parameter of regexp_substr() but would instead call this function for the particular substring, i.e.
select regexp_substr(substr('a234abcd', 5), '^[[:alpha:]]+')
-> returns 'abcd'
? That would work as wanted.
@Volker: You are correct, the output from your second example should be 'abcd', not null. The current behaviour is a bug and will be corrected in a future EBF.
As a work-around, you can use your suggested rewrite. i.e.
regexp_substr( s, p, n )
is the same as
regexp_substr( substr( s, n ), p )
Thank you for reporting the issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This has been fixed in 11.0.1 build 2379 and up.
I can confirm this behaviour for 11.0.1.2341.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
62 | |
10 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.