List:General Discussion« Previous MessageNext Message »
From:Douglas Brantz Date:January 29 2002 8:15pm
Subject:Pattern Matching Problem
View as plain text  
Hello,

I have a big problem! I need to match all patterns in schdays from a
variable schdays and if schdays = mwf it only turns up mwf and not all
entries containing M, W or F.  Is there a way to do this?  

mysql> select schdays from courses where schdays LIKE "%MWF%";
+---------+
| schdays |
+---------+
| MWF     |
+---------+
1 row in set (0.00 sec)

mysql> select schdays from courses where schdays LIKE "%M%";
+---------+
| schdays |
+---------+
| MWF     |
| MW      |
| MW      |
| M       |
| M       |
+---------+
5 rows in set (0.00 sec)

I need to be able to say select schdays from courses where schdays LIKE
"%schdays%"


Here is my code from the program:
my $sth2 = $dbh->prepare("select
id,schdays,time_to_sec(timein),time_to_sec(time
out) from courses where schdays LIKE \"\%$cschdays\%\" AND
done=\"Yes\"....etc..


So I need to be able to match any pattern with $cschdays.
Do I need to parse out the letters and pattern match each one??  It
should be easier.

Thanks,
Douglas
brantzdr@stripped

--
Douglas R. Brantz
Computer Consultant
Fine & Applied Arts
Appalachian State University
Boone, NC 28608

828-262-6549 (office)
828-262-6312 (fax)



Thread
Pattern Matching ProblemDouglas Brantz29 Jan
  • Re: Pattern Matching ProblemChristopher Thompson29 Jan
  • Re: Pattern Matching ProblemPaul DuBois29 Jan
RE: Pattern Matching ProblemMatthew Walker29 Jan
  • RE: Pattern Matching Problem SolvedDouglas Brantz29 Jan
RE: Pattern Matching ProblemBret Ewin29 Jan