>From the perl side, you could also split on / and then put each element in a hash with the value being a hashref for the next element's hash. ----- Original Message ----- From: "Jon Shoberg" <[EMAIL PROTECTED]> To: "Carsten H. Pedersen" <[EMAIL PROTECTED]>; "Beginners (E-mail)" <[EMAIL PROTECTED]> Cc: "*MySQL mail list" <[EMAIL PROTECTED]> Sent: Sunday, January 13, 2002 11:36 AM Subject: RE: Regexp Help !!!
> > Thanks ! > > Glad I asked for some other thoughts on this. I totally over looked this > and given how my indexes are setup, this will work much better. > > Thanks again, > Jon > > -----Original Message----- > From: Carsten H. Pedersen [mailto:[EMAIL PROTECTED]] > Sent: Sunday, January 13, 2002 11:26 AM > To: Jon Shoberg; Beginners (E-mail) > Cc: *MySQL mail list > Subject: RE: Regexp Help !!! > > > > -----Original Message----- > > From: Jon Shoberg [mailto:[EMAIL PROTECTED]] > > Sent: Sunday, January 13, 2002 4:47 PM > > To: Beginners (E-mail) > > Cc: *MySQL mail list; Jon Shoberg > > Subject: Regexp Help !!! > > > > > > Ok, > > > > I have a list/database of words that follows as ... > > > > Top > > ... > > Top/Arts/Food > > Top/Arts/Food/Country > > ... > > Top/World/America > > Top/World/Japan > > Top/World/Japan/Economy > > Top/World/Japan/Food > > Top/World/Japan/Food/Country > > Top/World/Japan/Food/Country/By_Chef > > > > ... > > > > How can I setup a regexp query/filter such that I can choose the > > prefix and > > the number of "/" in the results? > > > > Example: How can I query/filter the list such that I am looking for all > > "Top/World/" matches that have only one more word after them. So my only > > results from the example about would be "Top/World/America" and > > "Top/World/Japan". Then I would do the same for "Top/World/Japan" and get > > "Top/World/Japan/Economy" and then "Top/World/Japan/Food". This > > is part of > > the program so I can count the number of "/" in the query/filter > > string. I > > jsut want to exclude the extra matches. > > > > Any thoughts? > > > > Thanks > > Jon > > Not sure I would do it using regexps. Unless I misunderstand what > you're trying to do, I would consider using LIKE as this will often > be much faster: > > SELECT ... > WHERE data LIKE "TOP/World/Japan/%" > AND data NOT LIKE "TOP/World/Japan/%/%" > > - in essence: select all those records which start with > "TOP/World/Japan/", then subtract those which contain > any further "/". > > / Carsten > -- > Carsten H. Pedersen > keeper and maintainer of the bitbybit.dk MySQL FAQ > http://www.bitbybit.dk/mysqlfaq > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [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