• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 286
  • Last Modified:

REGEXP_LIKE ?? Should I use

I have been using the below code to do a key down filter using ajax but now I realize the regexp_like is not seeing the ( and ) as normal characters.
Should I be using this regexp_like here?
select group_name, group_id, rownum r from ( 
			 select group_name, group_id
			   from um_groups
			  where group_type_id = 2
			    and regexp_like( group_name,
				   nvl(l_search,group_name), 'i' )
			    and nvl(instr(':'||l_selected||':',
					 ':'||group_id||':'),0)=0 
			    and status_id = nvl(l_status_filter,1)
			  order by 1)

Open in new window

0
BILL Carlisle
Asked:
BILL Carlisle
  • 2
1 Solution
 
sdstuberCommented:
if "l_search"  is a string like  this


'(something)'     the ()  are regular expression delimiters to identify "something" as pattern.

if you want to search for the parentheses characters themselves.  you must prefix them with "\"

try modifying l_search like this...

replace(replace(l_search,'(','\('),')','\')
0
 
sdstuberCommented:
but...

if the only thing you're trying to do is an existence check of some substring  "like" or "instr" might be better, even with an UPPER to handle your case insenstive searching


and instr(upper(group_name), upper(nvl(l_search,group_name))) > 0


regexp are fairly expensive compared to other string functions. Unless your string parsing is complex enough to warrant the cost of regular expressions, I'd avoid them.
0
 
BILL CarlisleAPEX DeveloperAuthor Commented:
Thank you!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now