Page 1 of 1

camel casing regular expression

Posted: Fri Aug 09, 2013 2:44 pm
by sulu
Does anyone remember what the regular expression is for a string with mixed casing, such as: PageBreak
?

I need to read .NET articles where I have noun strings like this run together.

-su

Re: camel casing regular expression

Posted: Sat Aug 10, 2013 11:24 am
by Jim Bretti
One way you can match all camel case text in an article is with an expression like this:

[A-Z][a-z]+[A-Z][a-z]+

(The Case Sensitive checkbox for the dictionary entry should be checked).

If you're trying to insert a space before the 2nd upper case character, you may want to include a word boundary check (word boundary characters before and after the word). The complete dictionary entry could look like this:

Text Matching: Regular Expression:
(?<=\b)([A-Z][a-z]+)([A-Z][a-z]+)(?=\b)

Pronounce As: Respell:
$1 $2

Again, make sure the Case Sensitive checkbox is selected.

Is that what you're looking for?