Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old September 2nd, 2008, 07:09 AM
ashitpro's Avatar
Expert
 
Join Date: Aug 2007
Posts: 293
Default Regular expression in MySql....

Hello everybody,

I've strange situation here, May be MySql experts could help me out.
I've a table with single column, named 'exp', which contains the preloaded regular expressions. Now, I have string(URL) and I want to find out whether this url could be matched by any one of this 'exp'.

I tried something like this...
[code=mysql]
select 'my_url' REGEXP in (select exp from my_table);
[/code]
naturally it didn't work....

any solutions?
it would be great If we could manage this in single query.
Two queries would be fine...But not more than that...

Regards,
Ash

Last edited by Atli; September 2nd, 2008 at 11:03 PM. Reason: Added [code] tags
Reply
  #2  
Old September 2nd, 2008, 11:10 PM
Atli's Avatar
Moderator
 
Join Date: Nov 2006
Location: Iceland
Age: 22
Posts: 2,760
Default

Hi.

Did you try:
[code=mysql]
SELECT regexp_str FROM regTable
WHERE 'your_url' REGEXP regexp_str
[/code]
Reply
  #3  
Old September 4th, 2008, 07:35 AM
ashitpro's Avatar
Expert
 
Join Date: Aug 2007
Posts: 293
Default

Quote:
Originally Posted by Atli
Hi.

Did you try:
[code=mysql]
SELECT regexp_str FROM regTable
WHERE 'your_url' REGEXP regexp_str
[/code]

It worked.....
Thanks
Reply
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles