Gossamer Forum
Home : Products : DBMan : Customization :

Reg. Expression search errors

Quote Reply
Reg. Expression search errors
Hello, gang.

Per my admin's unyielding request, I showed him how to do a reg. expression search. (ie., * wildcard). It's pretty simple, and works just fine if the * is at the end of the word.

If it's in the middle, it ignores the wildcard, and thinks * is a character. No biggie really.

The crutch is when the * is at the beginning of the word. I work for HP, and we have lots of *Jet products (deskjet, laserjet, designjet, copyjet, etc.) I tried to search for "*jet support" to list entries that were for support for any jet line, and I got the error:
Code:
Error Message : fatal error: Undefined subroutine &main:: called at /home/httpd/cgi-bin/list/db.cgi line 393, chunk 1.
...
QUERY_STRING : db=default&uid=default&Category=---&Description=&keyword=*jet&mh=10&re=1&view_records=1&view_records=View+Records

Any idea on why this killed the code?
Quote Reply
Re: Reg. Expression search errors In reply to
I don't have an answer to your specific question, but you might find this thread very interesting as far as being able to perform the type of searches you might require.

Keyword Search & Multple word search

http://www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/000539.html
Quote Reply
Re: Reg. Expression search errors In reply to
Ah, yes, I know that thread. I have attempted to do that modification several times. Never seems to work. I always get a "search not found" screen, and in the description line it shows ~~search (search being the first word. the other two are not used in the search at all.)

But, that's not exactly what I was looking for.

I'm not trying to do a boolean search here. I've trying to use the reg. expression routine.

If I was to search for desk* with reg. exp. checked, I would get matches for desk, desks, deskjet, deskwriter, etc. everything that starts with desk.

if I want to search for *jet as a reg. exp., (ie., I want everything that ends in jet... deskjet, laserjet, officejet, designjet, scanjet, etc...) I get the error above. It chokes, and the CGI crashes.

Hope that explains it better?

------------------
----------------------------------------
Lee Leisure
HP Customer Relations Manager
----------------------------------------
* NOTE: This message is intended
for personal purposes only, and does
not imply the position or opinion of
the Hewlett Packard Company.


Quote Reply
Re: Reg. Expression search errors In reply to
I do not gaurantee that the following will work, but edit the following codes in the sub query routine in the db.cgi file:

Code:
($in{$db_cols[$field]} eq "*") and ($tmpreg = ".*");

with the following:

Code:
($in{$db_cols[$field]} eq "*") and ($tmpreg = ".*") and ($tmpreg = "*.");

Again, I do not gaurantee this will work.

Regards,



------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Reg. Expression search errors In reply to
Alas, it didn't work:

Code:
Error Message : fatal error: Undefined subroutine &main:: called at /home/httpd/cgi-bin/list/db.cgi line 393, chunk 1.

Oh well, back to the drawing board. Gotta move on. Here's another interesting question for you. All the other databases in HP are designed to use % as a wildcard. Don't ask me why, it doesn't make sense. It's just my job to comply. Could you suggest how to make this happen here? I've tried:

Code:
($in{$db_cols[$field]} eq "*") and ($tmpreg = ".*");
($in{$db_cols[$field]} eq "%") and ($tmpreg = ".%");

Any help would be hot.


----------------------------------------
Lee Leisure
HP Customer Relations Manager
----------------------------------------
* NOTE: This message is intended
for personal purposes only, and does
not imply the position or opinion of
the Hewlett Packard Company.


[This message has been edited by leisurelee (edited March 17, 2000).]