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-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
String.match on variable holding a regex?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password