>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...
> 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,
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
> 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
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
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" (
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
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
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
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
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
11 matches
Mail list logo