JRS: In article <rNcwg.15164$Nv .12737@fed1read 10>, dated Fri, 21 Jul
2006 15:44:40 remote, seen in news:comp.lang. javascript, Jeremy
<je****@pinacol .composted :
>Dr John Stockton wrote:
>>
But this : "camelCaseStrin g".match(/(\b|[A-Z])[a-z]*/g)
returns ['camel','Case', 'String']
And this : "camelCaseSTRin g".match(/(\b|[A-Z]+)[a-z]*/g)
returns ['camel','Case', 'STRing']
What does \b do? Never seen that before.
\b Matches a word boundary, that is, the position between a word and a
space. For example, 'er\b' matches the 'er' in "never" but not the 'er'
in "verb".
\b Matches a word boundary, such as a space. (Not to be confused with
[\b].) For example, /\bn\w/ matches the 'no' in "noonday";/\wy\b/
matches the 'ly' in "possibly yesterday."
Note that the documentations quoted above are inadequate, not really
defining "word boundary".
A Web search should find lists of RegExp parts.
<FAQENTRYRegExp s are often asked about, but the FAQ is little help
(two links in 4.16); AFAIK, the Notes do not cover them (IMHO, the FAQ
should have a link to EACH of the Motes).
Try the links in <URL:http://www.merlyn.demo n.co.uk/js-valid.htm>.
--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/>? JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.