[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua pattern match help
- From: Mark Hamburg <mhamburg@...>
- Date: Sat, 26 Jun 2004 05:16:21 -0700
"^%u%l+%u%l%a*$" does a slightly better job of filtering but it still needs
the secondary filter against double uppercase letters in the case of strings
with 3 or more uppercase letters. The combination of those two filters,
however, should give you everything you need.
on 6/26/04 4:10 AM, Antony Sidwell at email@example.com wrote:
> Joseph Stewart <firstname.lastname@example.org> wrote:
>> Can anyone suggest a pattern to match text in the following format:
>> Must start with a upper-case letter.
>> Must be followed by one or more lower-case letter.
>> Above conditions must repeat at least one time (but could be many).
> %u%l+%u%a+ is more or less as close as you can get using a simple
> pattern, which will match "ThisMAtchesWrongly" as well. Otherwise
> you're into a regex library or a bit more code, e.g.
> if string.find(s, "^%u%l+%u%a+$") and not string.find(s, "%u%u") then
> -- do stuff
> which I think is roughly what I used when I wanted to match
> WordsLikeThis without using a regular expression library.