Since robp's answer wasn't very descriptive, I'll expand a bit more.
When you are doing a regexp (regular expression), you can specify many options that tell PERL how should it match. The i option specifies that the search/match should be done in case insensitive, just like the g options specifies to match all occurrencies of a string.
The option must be right after the closing delimiter, in robp's case, the slash.
Here's an example:
if ($text =~ /$searchstring/i) { print "We have found the string \"$searchstring\" in our page." }
else { print "Sorry, no matches for \"$searchstring\". }
Regards,
Federico Carnales
---------- Reviews of the best resources for webmasters in your e-mail every week!
Subscribe for [red]FREE[/red] by going to http://www.web-reviews.com/
fairhousing posted this at 20:49 — 16th October 1999.
same database i've asked another question about. there's a member search feature. however, if you don't type the member's name in exactly as it is in the database it says they don't exist.
what's the simple code to look for both capital and non-capitol spellings of the same word?
i'm having one problem with the code above. it recognizes the following 2 names as the same name "michael" and "michael27". any ideas how to correct this?
You could make both strings lower case and compare them afterwards.
Later,
Malte
---------- Malte Ubl - [red]Germany[/red] - http://goKewl.com/
[red]The beats of 1000 hearts inside...[/red] the merciless pulsation... [red]and all I know is I'll be back...[/red] back to trance nation!
Federico Carnales posted this at 20:25 — 18th October 1999.
I'm not sure of the way you are doing the search on the databases, but say, if you are going through each line and getting different fields based on a delimiter, and you want to match exact strings on a specified field, then the code should be like:
if (lc($text) eq lc($searchstring)) { print "We have found the string \"$searchstring\" in ourpage." }
else { print "Sorry, no matches for \"$searchstring\". }
The lc function returns the lower case version of the string/variable, making the comparison case insensitive.
Regards.
---------- Reviews of the best resources for webmasters in your e-mail every week!
Subscribe for [red]FREE[/red] by going to http://www.web-reviews.com/
fairhousing posted this at 22:13 — 18th October 1999.
---------- Reviews of the best resources for webmasters in your e-mail every week!
Subscribe for [red]FREE[/red] by going to http://www.web-reviews.com/
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.
Federico Carnales posted this at 20:48 — 16th October 1999.
They have: 69 posts
Joined: Apr 1999
Since robp's answer wasn't very descriptive, I'll expand a bit more.
When you are doing a regexp (regular expression), you can specify many options that tell PERL how should it match. The i option specifies that the search/match should be done in case insensitive, just like the g options specifies to match all occurrencies of a string.
The option must be right after the closing delimiter, in robp's case, the slash.
Here's an example:
if ($text =~ /$searchstring/i) { print "We have found the string \"$searchstring\" in our page." }
else { print "Sorry, no matches for \"$searchstring\". }
Regards,
Federico Carnales
----------
Reviews of the best resources for webmasters in your e-mail every week!
Subscribe for [red]FREE[/red] by going to http://www.web-reviews.com/
fairhousing posted this at 20:49 — 16th October 1999.
They have: 1,587 posts
Joined: Mar 1999
same database i've asked another question about. there's a member search feature. however, if you don't type the member's name in exactly as it is in the database it says they don't exist.
what's the simple code to look for both capital and non-capitol spellings of the same word?
thanks in advance
----------
My Site Got Hacked, Check It Out!
http://www.birminghamnet.com
Traffic-Website.com free traffic, affiliate programs, hosting, & domain names.
My Site got hacked, but i'm coming back?
fairhousing posted this at 00:38 — 17th October 1999.
They have: 1,587 posts
Joined: Mar 1999
very helpful, thanks
----------
My Site Got Hacked, Check It Out!
http://www.birminghamnet.com
fairhousing posted this at 17:13 — 18th October 1999.
They have: 1,587 posts
Joined: Mar 1999
i'm having one problem with the code above. it recognizes the following 2 names as the same name "michael" and "michael27". any ideas how to correct this?
thanks in advance
----------
My Site Got Hacked, Check It Out!
http://www.birminghamnet.com
Traffic-Website.com free traffic, affiliate programs, hosting, & domain names.
My Site got hacked, but i'm coming back?
Malte posted this at 19:40 — 18th October 1999.
They have: 297 posts
Joined: Apr 1999
You could make both strings lower case and compare them afterwards.
Later,
Malte
----------
Malte Ubl - [red]Germany[/red] - http://goKewl.com/
[red]The beats of 1000 hearts inside...[/red] the merciless pulsation... [red]and all I know is I'll be back...[/red] back to trance nation!
Federico Carnales posted this at 20:25 — 18th October 1999.
They have: 69 posts
Joined: Apr 1999
fairhousing,
I'm not sure of the way you are doing the search on the databases, but say, if you are going through each line and getting different fields based on a delimiter, and you want to match exact strings on a specified field, then the code should be like:
if (lc($text) eq lc($searchstring)) { print "We have found the string \"$searchstring\" in ourpage." }
else { print "Sorry, no matches for \"$searchstring\". }
The lc function returns the lower case version of the string/variable, making the comparison case insensitive.
Regards.
----------
Reviews of the best resources for webmasters in your e-mail every week!
Subscribe for [red]FREE[/red] by going to http://www.web-reviews.com/
fairhousing posted this at 22:13 — 18th October 1999.
They have: 1,587 posts
Joined: Mar 1999
thanks again
----------
My Site Got Hacked, Check It Out!
http://www.birminghamnet.com
fairhousing posted this at 22:30 — 18th October 1999.
They have: 1,587 posts
Joined: Mar 1999
just letting you know it works like a charm that way. thanks a bunch.
----------
My Site Got Hacked, Check It Out!
http://www.birminghamnet.com
Federico Carnales posted this at 02:46 — 19th October 1999.
They have: 69 posts
Joined: Apr 1999
You're welcome
----------
Reviews of the best resources for webmasters in your e-mail every week!
Subscribe for [red]FREE[/red] by going to http://www.web-reviews.com/
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.