david bovill wrote:
What's the quickest way to find all the CamelCase words in some text
- anyone have a regular expression or script for this?
Depends on your definition of CamelCase !!
There are lots of variations possible
- must have leading Uppercase (aka UpperCamelCase)
- may not have that (lowerCamelCase, camelCase)
- can it finish with an uppercase (e.g. EndsWithA) ?
- lower case start, upper finish ? (e.g. lowerA)
The simple version of a regular expression which allows all of these is
([A-Z]*[a-z]+[A-Z]+[a-zA-Z]*)
i.e.
0 or more Upper,
followed by at least one lower,
followed by at least one upper,
possibly followed by any number of either ....
However, if this is for variable names, then you might also want to
allow for digits and "_" in some places - this would make the regex more
complex. (I don't think I could dependably tell you what it would be ...)
--
Alex Tweedly http://www.tweedly.net
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.16/83 - Release Date: 26/08/2005
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution