[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

String.match on variable holding a regex?

Finn Koch

8/23/2007 5:24:00 PM

Hi, I'm having a little problem with matching a regex against a string.
I am storing data in mysql as a regex. At some point I need to match a
string to this regex. Here is what I am working with:


result = @dbconn.query("SELECT id, to_user_regex FROM next")
result.each do |row|
@to_user_regex = row[1]
@messages << row[0] if
@user.match(/@to_user_regex/)
end


So lets say @user is a string holding 'name1' and @to_user_regex is
'name1|name2'. I'm trying to match this. Does anyone have any ideas as
to why this wouldn't be matching?

Thanks!

upenox
--
Posted via http://www.ruby-....

2 Answers

David A. Black

8/23/2007 5:35:00 PM

0

Finn Koch

8/23/2007 6:03:00 PM

0

David A. Black wrote:

>
>
> David

Wow, that was dumb...I forgot about using interpolation(sp?) on there.
Thanks!!! :D
--
Posted via http://www.ruby-....