PDA

View Full Version : Regex???


Infinite
04-16-2007, 06:42 PM
Anyone a Regex god here?

I am trying to get this to work correct, I want to have an expression that can validate Class/Interface calls... the part that isn't working is the part that verifys the optional "extends" or "implements" call. This expression work for a string like this:

"class visa.HostVideo extends MovieClip {"

but not this :

"class visa.HostVideo {"

Here is my Regex Expression

\b(?:class|interface)\s++([\w.*]++)(?:\s++(?:extends|implements)\s++[\w.*]++)\s*+{

Infinite
04-16-2007, 06:46 PM
I guess I have to be inspired with the solution after asking a question.... blaa. Here is the answer.

\b(?:class|interface)\s++([\w.*]++)(?:(\s++(?:extends|implements)\s++[\w.*]++))*\s*+{

:)