Re: [PHP] regex and global vars problem

2005-10-28 Thread Robin Vickery
On 10/28/05, Tom Rogers <[EMAIL PROTECTED]> wrote: > > I would do it with a small class like this: > > class mac{ > var $mac=''; > var $is_valid = false; > function mac($mac){ > $mac = preg_replace('/[^0-9A-F]/','',strtoupper($mac)); > if($this->is_valid = > preg_match('/^(\w{2})(\w

Re: [PHP] regex and global vars problem

2005-10-27 Thread Tom Rogers
Hi, Thursday, October 27, 2005, 3:15:30 AM, you wrote: JG> I am having a problem with a couple of function I have written to check JG> for a type of string, attempt to fix it and pass it back to the main JG> function. Any help is appreciated. I would do it with a small class like this: is_valid

Re: [PHP] regex and global vars problem

2005-10-27 Thread Jasper Bryant-Greene
On Thu, 2005-10-27 at 00:00 +0200, Jochem Maas wrote: > gonna jump on your thread there Jasper, I would > like to comment on your function and ask you a question: > > which is 'better' (for what), preg_*() or ereg[i]*()? I prefer preg_*(), but I used eregi() because I couldn't be bothered figurin

Re: [PHP] regex and global vars problem

2005-10-27 Thread Richard Heyes
Jochem Maas wrote: Richard Heyes wrote: Jochem Maas wrote: > gonna jump on your thread there Jasper, I would > like to comment on your function and ask you a question: > > which is 'better' (for what), preg_*() or ereg[i]*()? preg_*, for anything. They're faster, and more versatile. coo

Re: [PHP] regex and global vars problem

2005-10-27 Thread Jochem Maas
Richard Heyes wrote: Jochem Maas wrote: > gonna jump on your thread there Jasper, I would > like to comment on your function and ask you a question: > > which is 'better' (for what), preg_*() or ereg[i]*()? preg_*, for anything. They're faster, and more versatile. cool cheers. I guess you

Re: [PHP] regex and global vars problem

2005-10-27 Thread Richard Heyes
Jochem Maas wrote: > gonna jump on your thread there Jasper, I would > like to comment on your function and ask you a question: > > which is 'better' (for what), preg_*() or ereg[i]*()? preg_*, for anything. They're faster, and more versatile. -- Richard Heyes http://www.phpguru.org -- PHP Gene

Re: [PHP] regex and global vars problem

2005-10-26 Thread Jochem Maas
gonna jump on your thread there Jasper, I would like to comment on your function and ask you a question: which is 'better' (for what), preg_*() or ereg[i]*()? Jasper Bryant-Greene wrote: On Wed, 2005-10-26 at 12:24 -0600, Jason Gerfen wrote: The code I just showed you is supposed to do the fol

Re: [PHP] regex and global vars problem

2005-10-26 Thread Jasper Bryant-Greene
On Wed, 2005-10-26 at 12:24 -0600, Jason Gerfen wrote: > The code I just showed you is supposed to do the following, the > chk_mac() returns a true or false on the vars $mac1, $mac2 and $mac3. > $mac3 is the only var that should not be thrown into the fix_mac() > function which is working corre

Re: [PHP] regex and global vars problem

2005-10-26 Thread Jason Gerfen
The code I just showed you is supposed to do the following, the chk_mac() returns a true or false on the vars $mac1, $mac2 and $mac3. $mac3 is the only var that should not be thrown into the fix_mac() function which is working correctly. The problem is when $mac1 and $mac2 get put into the fi

Re: [PHP] regex and global vars problem

2005-10-26 Thread Jasper Bryant-Greene
On Wed, 2005-10-26 at 12:07 -0600, Jason Gerfen wrote: > Um I did actually, but I will re-interate the problem with more detail. > > the vars $mac1, $mac2, & $mac3 are to get passed to the chk_mac() > function which determines if it is a valid hex representation of a h/w > address, if it does no

Re: [PHP] regex and global vars problem

2005-10-26 Thread Jason Gerfen
Um I did actually, but I will re-interate the problem with more detail. the vars $mac1, $mac2, & $mac3 are to get passed to the chk_mac() function which determines if it is a valid hex representation of a h/w address, if it does not meet the criteria of having a ":" separating every two charac

Re: [PHP] regex and global vars problem

2005-10-26 Thread Jasper Bryant-Greene
On Wed, 2005-10-26 at 11:15 -0600, Jason Gerfen wrote: > I am having a problem with a couple of function I have written to check > for a type of string, attempt to fix it and pass it back to the main > function. Any help is appreciated. [snip] Would you mind telling us what the problem was? --

Re: [PHP] Regex and variable usage

2003-07-16 Thread Nomadeous
Gerard Samuel a écrit: Curt Zirzow wrote: Gerard Samuel <[EMAIL PROTECTED]> wrote: or even preg_match('/^[a-z0-9\-_\.]+\.[a-z0-9]{' . $foo . ', ' . $bar . '}$/', $some_string) I think, you Forgot, a \ before the $ at the end of the expression... that should work. Unfortunately it doesn'

Re: [PHP] Regex and variable usage

2003-07-16 Thread Gerard Samuel
Curt Zirzow wrote: Gerard Samuel <[EMAIL PROTECTED]> wrote: or even preg_match('/^[a-z0-9\-_\.]+\.[a-z0-9]{' . $foo . ', ' . $bar . '}$/', $some_string) that should work. Unfortunately it doesn't for some reason. Don't know why. but you could do this: $pattern = "/^[a-z0-9\-_\.]+\.[a-z

Re: [PHP] Regex and variable usage

2003-07-16 Thread Curt Zirzow
Gerard Samuel <[EMAIL PROTECTED]> wrote: > Has anyone had any success with using variables in a regex shown below?? > > $foo = 3; > $bar = 4; > preg_match('/^[a-z0-9\-_\.]+\.[a-z0-9]{$foo, $bar}$/', $some_string) You have single quotes, so php wont expand the variables inside. > > or even > pre

Re: [PHP] RegEx and ?

2002-04-24 Thread Marius Ursache
use \? instead of ? Boaz Yahav a écrit : > When i try to use preg_match on strings that have "?" inside them it > seems to not work. > Any ideas how to bypass this? > > thanks > > berber -- Marius Ursache (3563 || 3494) \|/ \|/ "@'/

Re: [PHP] RegEx and ?

2002-04-24 Thread Marius Ursache
Boaz Yahav a écrit : > When i try to use preg_match on strings that have "?" inside them it > seems to not work. > Any ideas how to bypass this? > > thanks > > berber -- Marius Ursache (3563 || 3494) \|/ \|/ "@'/ ,. \`@"

Re: [PHP] regex and mysql - looking for opinions.

2001-04-19 Thread Christian Reiniger
On Wednesday 18 April 2001 22:03, you wrote: > and do various searches etc. I was curious as to what most people find > the best way keep thier mysql queries from getting messed up by user > entered data. None of my searches or database data has or needs any Simply using addslashes () or the mag

Re: [PHP] regex and mysql - looking for opinions.

2001-04-18 Thread Plutarck
I use a special function just for reforming input, but they use the following bits with PCRE: $replace_wordwhite = '/[^\w\s]/'; $replace_word = '/\W/'; $replace_num = '/\D/'; $replace_email = '/[^\w\-\.@]/'; Works pretty well and it's quite useful for killing useless input without returning