Re: [PHP] regexps

2003-01-28 Thread ng
>using any of the string functions on the output would ofcourse > cause a performance drawback (do you agree with me?), i had > used a combination of string functions to do instead of regexps, > which one will be faster as you think ? Hi, i made some basic bench and see that it really depends...

RE: [PHP] regexps

2003-01-28 Thread John W. Holmes
> using any of the string functions on the output would ofcourse cause a > performance drawback (do you agree with me?), i had used a combination of > string functions to do instead of regexps, which one will be faster as you > think ? It depends on exactly what your doing, how much text you have,

Re: [PHP] regexps

2003-01-28 Thread Khalid El-Kary
using any of the string functions on the output would ofcourse cause a performance drawback (do you agree with me?), i had used a combination of string functions to do instead of regexps, which one will be faster as you think ? where can i suggest such a function on the current regexps API ? T

Re: [PHP] regexps

2003-01-28 Thread 1LT John W. Holmes
> I need to use regular expressions, but i found that the current > Perl-compaitable API unuseful in my case, infact i need to get the positions > of every match to the pattern and i found nothing in the Manual that does > so, does any one know a way to do this (the only one i found is specific to

Re: [PHP] regexps

2001-08-08 Thread Daniel James
if (preg_match("/\d/", $data) { print 'The $data contained a number'; } On 2001.08.09 07:05 scott [gts] wrote: > here are two regexps that might do what you want > > "\w" matches alphanum (1-9a-zA-z) > > IMO, the best way to check for non-alphanum chars is > to check for "\W" (upper cas

Re: [PHP] regexps

2001-08-08 Thread CC Zona
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Scott) wrote: > here are two regexps that might do what you want > > "\w" matches alphanum (1-9a-zA-z) (0-9a-zA-Z_) actually. Don't forget that zero and underscore! > IMO, the best way to check for non-alphanum chars is > to check for "\W" (

RE: [PHP] regexps

2001-08-08 Thread scott [gts]
here are two regexps that might do what you want "\w" matches alphanum (1-9a-zA-z) IMO, the best way to check for non-alphanum chars is to check for "\W" (upper case is negation of alphanum, which will match only non-alphanum). if (preg_match('/^\w+$/', $data)) { print "entirely alpha

Re: [PHP] regexps

2001-01-17 Thread Monte Ohrt
preg_replace will implicitly allow arrays of values for the search/replace strings. Toby Butzon wrote: > > You could loop it with foreach (which I think is the same way Perl handles > the ex you gave). > > foreach ($myArr as $myStr) { > $myStr = ereg_replace($regexp, $myStr); > } > > Note

Re: [PHP] regexps

2001-01-16 Thread Toby Butzon
You could loop it with foreach (which I think is the same way Perl handles the ex you gave). foreach ($myArr as $myStr) { $myStr = ereg_replace($regexp, $myStr); } Note quite "one statement", but if you really wanted to shorted it (and in the opinion of most sacrafice readability), you could

Re: [PHP] regexps

2001-01-16 Thread Monte Ohrt
Most of the preg_ functions support arrays of values as input parameters. It's all in the documentation. "Elliot L. Tobin" wrote: > > Is there a way to call one regexp on multiple variables, in one statement? > In Perl, I'd do: > > s/this/that for ($var1, $var2, $var3); > > tia.. and please re

Re: [PHP] regexps

2001-01-16 Thread Romulo Roberto Pereira
Why don't you do a function with an ereg inside? I don't think that exist a command like that... Rom - Original Message - From: Elliot L. Tobin <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 16, 2001 11:59 AM Subject: [PHP] regexps Is there a way to call one regexp