[Javascript] regular expressions for Javascript

liorean liorean at f2o.org
Thu May 13 14:17:42 CDT 2004


Shawn Milo wrote:
> I've done a little work on my regex primer.  Actually, I've
> made a copy, and customized it for Javascript.  I'm hoping that
> some of you might take a look at it, and give me suggestions
> for how I can improve on it.  When I think that it is 
> in good shape, I'm going to post it on comp.lang.javascript
> as a general guide.
> 
> http://linurati.net/shawn/regex_js.html

I would recommend you to add a few links to reseources that explain a little more in-detail, or at least throw in links to the resources on the subject available from MSDN and Devedge.
<http://devedge.netscape.com/library/manuals/2000/javascript/1.5/reference/regexp.html#1193136>
<http://devedge.netscape.com/library/manuals/2000/javascript/1.5/reference/string.html>
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jsobjRegExp.asp>
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jsobjstring.asp>

I have myself written an article on the subject that you might want to link as well:
<http://www.evolt.org/article/Regular_Expressions_in_JavaScript/17/36435/>


Well, on to separate issues, then.
- I think you should explain what '$2' means as the second argument to String.replace before you use it for the first time instead of long after.
- In the test if a string is all numeric, why are you useing [0-9] instead of \d?
- I think it would be better if you used one highlighting for code samples, and one highlighting for the regular expression pattern.
-- 
David "liorean" Andersson

ViewStyles, ViewScripts, SwitchStyles and GraphicsInfo bookmarklets:
<http://liorean.web-graphics.com/>
Hangouts:
<http://codingforums.com/> <http://yourmusicforums.com/>



More information about the Javascript mailing list