co***********@hotmail.com (Holden Caulfield) writes:
Does no one know of a good source for ready-to-go Regular
Expressions??
I personally wouldn't use such a source any more.
I posted what I thought was a good expression for syntactically
correct email addresses. It was even taken from a pretty respectable
source (Danny Goodman's "Dynamic HTML: The Definitive Reference").
Lasse (and some others? I don't remember) pointed out quite correctly
that it was a long way from accepting all email addresses valid
according to RFC 2822. I didn't read the spec. I guess Goodman
didn't either.
The effort you exert to "reinvent the wheel" is likely to be
comparable to the effort you exert to try two or three dubious
candidates from various sources, dissect them symbol-by-symbol and
test boundary cases to verify that they meet your needs. If you've
defined your needs precisely enough that you can do that, you know
almost everything you need to know to write the expression yourself
anyway.
All that being said, I suppose that /[0-9A-Fa-f]*/ can be relied upon
to match a string of zero or more hexadecimal digits, _if_ your
definition of "hexadecimal digit" is "0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A,
B, C, D, E, F, a, b, c, d, e, or f". Whether that definition is
satisfactory depends on your needs. In India, for example, the
customary decimal numerals are different and have different code
points in Unicode; I don't know what the customary hexadecimal
numerals are.
The point, which I am belaboring, is that you must know _exactly_ the
class of strings you intend to accept, and then you have more or less
written the expression already.
And, as other people say about once a day on this group, you cannot
rely on client-side form validation, so you have to duplicate your
expressions (possibly in a language with slightly different RE
semantics) server-side.
--
Chris Jeris
cj****@oinvzer.net Apply (1 6 2 4)(3 7) to domain to reply.