[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua pattern match help
- From: Antony Sidwell <antony@...>
- Date: Sat, 26 Jun 2004 12:10:03 +0100
Joseph Stewart <joseph.stewart@gmail.com> 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
end
which I think is roughly what I used when I wanted to match
WordsLikeThis without using a regular expression library.
--
Antony Sidwell.