Feedback on Regex book prototype

26 views
Skip to first unread message

Staffan Nöteberg

unread,
Oct 1, 2012, 12:20:46 PM10/1/12
to re...@googlegroups.com
Hi all,

I've published a prototype of an upcoming Regex book here: http://www.staffannoteberg.com/regexbook

Any feedback, off-list, is very very appreciated. What would make this book more useful for you?


Best Regards // Staffan

Jim Michaels

unread,
Oct 16, 2012, 8:12:24 PM10/16/12
to re...@googlegroups.com
HTML5 is really big now, and pattern validation for input tags is part of this. the browser will show the control as red or disallow input if the input is wrong.

regex patterns for commonly used HTML5 number validations.  also, please list javascript/ecmascript 262 5.1 regex,it is a small subset of normal regex. things like \d are not available. I think the patterns used for browser regex is ecmascript/javascript regex.  the specification is here:

integer 0 and above: pattern="^[0-9]+$"
integer 1 and above: pattern="^[1-9][0-9]*$"
0 or positive integer or positive simple real number like 1.1 or 1: pattern="^[0-9](\.[0-9]+)?$"
0 or positive integer or positive simple real number like 1.1 or 1.1e-200 or 1: pattern="^[0-9](\.[0-9]+)?([Ee][+-]?[0-9]+)?$"

integer: pattern="^[+-]?[0-9]+$"
nonzero integer: pattern="^[+-]?[1-9][0-9]*$"
integer or simple real number like 1.1 or 1: pattern="^[+-]?[0-9](\.[0-9]+)?$"
integer or simple real number like 1.1 or 1.1e-200 or 1: pattern="^[+-]?[0-9](\.[0-9]+)?([Ee][+-]?[0-9]+)?$"

 phone number validations come in a variety of regexes.
(555)-111-2222  pattern="^\([0-9][0-9][0-9]\)\-[0-9][0-9][0-9]\-[0-9][0-9][0-9][0-9]$"
(555).111.2222  pattern="^\([0-9][0-9][0-9]\)\.[0-9][0-9][0-9]\.[0-9][0-9][0-9][0-9]$"
555-111-2222  pattern="^[0-9][0-9][0-9]\-[0-9][0-9][0-9]\-[0-9][0-9][0-9][0-9]$"
555.111.2222  pattern="^[0-9][0-9][0-9]\.[0-9][0-9][0-9]\.[0-9][0-9][0-9][0-9]$"
1-(555)-111-2222  pattern="^\1\-([0-9][0-9][0-9]\)\-[0-9][0-9][0-9]\-[0-9][0-9][0-9][0-9]$"(555).111.2222  pattern="^\([0-9][0-9][0-9]\)\.[0-9][0-9][0-9]\.[0-9][0-9][0-9][0-9]$"
1-555-111-2222  pattern="^1\-[0-9][0-9][0-9]\-[0-9][0-9][0-9]\-[0-9][0-9][0-9][0-9]$"
1.555.111.2222  pattern="^1\.[0-9][0-9][0-9]\.[0-9][0-9][0-9]\.[0-9][0-9][0-9][0-9]$"

there are also 7-digit local phone numbers.  but these are rarely used in web sites.

111-2222  pattern="^[0-9][0-9][0-9]\-[0-9][0-9][0-9][0-9]$"
111.2222  pattern="^[0-9][0-9][0-9]\.[0-9][0-9][0-9][0-9]$"

zip code validation in the USA is pretty simple. it is either 5 digits or 5 digits followed by a dash followed by 4 digits.
canada used alphanumerics for their postal code.
5-digit zip code: pattern="^[0-9][0-9][0-9][0-9][0-9]$"
zip+4: pattern="^[0-9][0-9][0-9][0-9][0-9]\-[0-9][0-9][0-9][0-9]$"
either zip or zip+4: pattern="^[0-9][0-9][0-9][0-9][0-9](\-[0-9][0-9][0-9][0-9])?$"

there are regexes also for iso 8601 (I think it was) date/time input into HTML5. a subset is supported via the input element.


I will tell you right now I don't like spiders. it would be a book I would not buy.


From: Staffan Nöteberg <staffan....@rekursiv.se>
To: re...@googlegroups.com
Sent: Monday, October 1, 2012 9:20 AM
Subject: [REGEX] Feedback on Regex book prototype

--
--
Sub, Unsub, Read-on-the-web, tune your personal settings for this Regex forum:
http://groups.google.com/group/regex?hl=en
 
 
 


Jim Michaels

unread,
Oct 16, 2012, 9:26:09 PM10/16/12
to re...@googlegroups.com
wouldn't it be illegal to publish a book on how to spam?


From: Jim Michaels <jmic...@yahoo.com>
To: "re...@googlegroups.com" <re...@googlegroups.com>
Sent: Tuesday, October 16, 2012 5:12 PM
Subject: Re: [REGEX] Feedback on Regex book prototype

Eugeny....@gmail.com

unread,
Oct 20, 2012, 3:30:14 PM10/20/12
to re...@googlegroups.com
Jim,
Staffan welcomed off-list comments only.
SN> Any feedback, off-list, is very very appreciated.
Thank you.
Eugeny


On Wednesday, October 17, 2012 5:26:12 AM UTC+4, Jim Michaels wrote:
wouldn't it be illegal to publish a book on how to spam?
<snip>
Reply all
Reply to author
Forward
0 new messages