RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Extract all class names from a PHP file
Expression
/class\s+([a-z0-9_]+)(?:\s+extends\s+[a-z0-9_]+)?(?:\s+implements\s+(?:[a-z0-9_]+\s*,*\s*)+)?\s*\{/Usi
Description
This expression extract all class names from a php source code. E.g. it will extract A from the following declarations
Matches
class A {} | class A extends B {} | class A extends B implements C {} | class A extends B implements C,D {} | class A implements B {} | class A implements B,C {}
Non-Matches
class A implements B extends C (invalid PHP syntax)
Author Rating: The rating for this expression. Andris
Source
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Copyright © 2001-2025, RegexAdvice.com | ASP.NET Tutorials