You still have not mentioned what language you are using to interface with MySQL. If you are using PHP or Perl, then things like single and double quotes will make a difference here, and looking in the MySQL manual will not help you. Check the string that contains the query, if it looks like this:
$q = 'select xxxx from table where col regexp "$var"'; change it to $q = "select xxxx from table where col regexp '$var'"; The enclosing single quotes are keeping the value of $var from being interpolated into the string in the above example. See the manual for your programming language for more information on variable interpolation. On Mon, 2002-12-09 at 08:22, Beauford.2003 wrote: > I am using PHP on my website, but this is certainly a MySQL question. > > > That shouldn't matter, because the real value $var is inserted before > > the query is send to the MySQL server, where REGEXP of the query is > > evaluated. If there is a problem, you need to be much more > > specific. Quote the error message, show the relevant part of your code > > and so on. > > The real value of $var is not inserted before it is sent to the server. > REGEXP thinks that 'var' is part of the search pattern because $ is a > reserved operator for REGEXP. So what gets sent to the server is totally > different than what I want to be sent. There are no errors because the > syntax is correct, its just not correct for the search I want it to perform. > So the questions still remains, how do I get REGEXP to treat $var as a > variable and not part of its own syntax. > > I have been looking at http://www.mysql.com/doc/en/Regexp.html, but it does > not cover this. > > ----- Original Message ----- > From: "Benjamin Pflugmann" <[EMAIL PROTECTED]> > To: "Beauford.2003" <[EMAIL PROTECTED]> > Cc: "Robert Citek" <[EMAIL PROTECTED]>; "MySQL List" > <[EMAIL PROTECTED]> > Sent: Monday, December 09, 2002 3:30 AM > Subject: Re: Select * From table where name Like 'help'; Help > > > > Hello. > > > > On Mon 2002-12-09 at 01:00:33 -0500, [EMAIL PROTECTED] wrote: > > > I am doing this search from a website, > > > > What does that mean? Which scripting language do you use? PHP? This is > > more a question for your "website" environment than about MySQL. > > > > > and from what I can tell there is no way to use a variable > > > (i.e. $var) with REGEXP as the $ sign has a special meaning to > > > REGEXP. > > > > That shouldn't matter, because the real value $var is inserted before > > the query is send to the MySQL server, where REGEXP of the query is > > evaluated. If there is a problem, you need to be much more > > specific. Quote the error message, show the relevant part of your code > > and so on. > > > > HTH, > > > > Benjamin. > > > > -- > > [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- > > Before posting, please check: > > http://www.mysql.com/manual.php (the manual) > > http://lists.mysql.com/ (the list archive) > > > > To request this thread, e-mail <[EMAIL PROTECTED]> > > To unsubscribe, e-mail > <[EMAIL PROTECTED]> > > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > > > > > > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php