[PHP] Checking for plus signs?
I'm trying if(eregi(+,$variable)){, but it gives me an error. What do I do?
Re: [PHP] Checking for plus signs?
What's the error? Tyler - Original Message - From: Leif K-Brooks [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 07, 2002 7:40 PM Subject: [PHP] Checking for plus signs? I'm trying if(eregi(+,$variable)){, but it gives me an error. What do I do? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking for plus signs?
The plus is a special character for regular expressions. You need to escape it in order to search for a literal + Try this: eregi(\\+, $variable) Jeff At 08:40 PM 2/7/2002 -0500, you wrote: I'm trying if(eregi(+,$variable)){, but it gives me an error. What do I do? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking for plus signs?
try this if(eregi(/\+/,$variable)) Jim Lucas - Original Message - From: Leif K-Brooks [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 07, 2002 5:40 PM Subject: [PHP] Checking for plus signs? I'm trying if(eregi(+,$variable)){, but it gives me an error. What do I do? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking for plus signs?
Actually, all you need is this: if(eregi(\+,$variable)) You only need to escape the + sign once. Tyler - Original Message - From: Jim Lucas [php] [EMAIL PROTECTED] To: Leif K-Brooks [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, February 07, 2002 7:39 PM Subject: Re: [PHP] Checking for plus signs? try this if(eregi(/\+/,$variable)) Jim Lucas - Original Message - From: Leif K-Brooks [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 07, 2002 5:40 PM Subject: [PHP] Checking for plus signs? I'm trying if(eregi(+,$variable)){, but it gives me an error. What do I do? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Checking for plus signs?
remember to escape the escape character so php passes it onto the reg.ex. function correctly, so: if(eregi(\\+,$variable)) -Original Message- From: Tyler Longren [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 12:54 PM To: Jim Lucas [php]; Leif K-Brooks; [EMAIL PROTECTED] Subject: Re: [PHP] Checking for plus signs? Actually, all you need is this: if(eregi(\+,$variable)) You only need to escape the + sign once. Tyler - Original Message - From: Jim Lucas [php] [EMAIL PROTECTED] To: Leif K-Brooks [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, February 07, 2002 7:39 PM Subject: Re: [PHP] Checking for plus signs? try this if(eregi(/\+/,$variable)) Jim Lucas - Original Message - From: Leif K-Brooks [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 07, 2002 5:40 PM Subject: [PHP] Checking for plus signs? I'm trying if(eregi(+,$variable)){, but it gives me an error. What do I do? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php