This is a weird one - I've put it in the "Apex - Session State" category, but I'm not even sure that is correct...
I ran into this issue on my Search page, where sometimes the result would not be the part of the text containing the search term, but rather the start of the text.
Take a look at the two view queries below, which are identical except for a materialize hint in one of them.
In these views, I use a page item as the text to search for: "v('P1184_SEARCH_FOR') as search_for".
Turns out that the reason for the original view (which does not have the hint) to return the first part of the text, is the use of v('P1184_SEARCH_FOR') in the view query
in combination with joining an Apex view - in this case apex_application_page_regions.
If I:
change the v() function to a hardcoded string,
OR remove the join to the Apex view,
OR hardcode the search term in the regexp_instr functions,
OR use a materialize hint,
it works fine.
So what's going on here? Well, I'm not sure really :-)
Maybe the Apex view switches to another session somehow, so that after the Apex view has been joined, the v('P1184_SEARCH_FOR') function then returns null (in regexp_instr)?
Something like that, maybe...
The simplest solution here was to add a materialize hint to the view. This ensures the value of "search_for" is only read once, and therefore stays the same "during" the query.