Syntactic Confectionery Delight | |
PerlMonks |
Re^2: Regexp to match IP addressby Prior Nacre V (Hermit) |
on Oct 02, 2004 at 02:52 UTC ( [id://395803]=note: print w/replies, xml ) | Need Help?? |
I haven't used Javascript for 4 or 5 years. Check up-to-date documentation where appropriate. I believe Javascript1.3 REs were the same as Perl4's. More recent JS versions may map to more recent Perl versions. However, while the latest version may provide the best solution, consider whether your intended audience will have browsers incorporating the latest JS version. Any testing you do on the client side (e.g. Javascript in HTML) must be repeated on the server side (e.g. Perl CGI script). If you can use the same RE in both, this is possibly a good idea for consistency purposes; other considerations may override this. I don't think your RE matches 0.n.n.n (from visual inspection). Was this intended? If not, I think you'll need: re=/^([0-9]|... Finally, I recall running into difficulties due to differences between JavaScript, JScript and ECMAscript. Something to bear in mind if you're using advanced features. Regards, PN5
In Section
Seekers of Perl Wisdom
|
|