Page 1 of 1

Which Regex is superior?

Posted: Sun Aug 07, 2005 6:44 am
by raghavan20
I have been using Regex in JavaScript in my applications. But I am wondering which one is the best and to be honest I dont know more about php Regex or Perl Regex.

1. Do you guys think that there are significant adv available in PHP over Javascript Regex?

2. Is Perl Regex superior to PHP Regex?

Posted: Sun Aug 07, 2005 7:19 am
by feyd
PCRE regex is typically superior. Perl is the origin of that variant. PHP has the preg_* which are PCRE. Javascript is similarly done... so the best... that depends on where you need it :)

Posted: Sun Aug 07, 2005 8:57 am
by Chris Corbyn
JavaScript processing speed isn't too fast in comparison with PHP but that's not specific to regex and it depends upon the spec of the client machine. If there's no real reason to do it in JavaScript then dont because:

a).. They mightn't have JS on
b).. It may be slower

Posted: Sun Aug 07, 2005 9:00 am
by raghavan20
Is there is anyway to find out the client machine has JavaScript enabled?
The reason I am using JavaScript cos if its executed at client machine, it wont overload the server.

Posted: Sun Aug 07, 2005 9:05 am
by feyd
it's pretty easy to tell if JS is enabled:

Code: Select all

<script language="Javascript">document.write('<img src="jsEnabled.php" />');</scirpt><noscript><img src="realfile.png" /></noscript>
where jsEnabled.php would output realfile.png, but also record/set up/whatever that the user has JS enabled.

Posted: Sun Aug 07, 2005 9:17 am
by raghavan20
Is it possible to know it by value? like, I want to execute an condition and get the result as True or False to find whether Javascript is enabled.

Posted: Sun Aug 07, 2005 9:27 am
by feyd
it won't execute at all if javascript isn't enabled..