Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Regexp to match IP address

by Prior Nacre V (Hermit)
on Oct 02, 2004 at 02:52 UTC ( #395803=note: print w/replies, xml ) Need Help??


in reply to Re: Regexp to match IP address
in thread Regexp to match IP address

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://395803]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2022-05-28 08:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (98 votes). Check out past polls.

    Notices?