PHP regular expression problem

Discussion in 'PHP' started by nihcer, Nov 7, 2009.

  1. #1
    Can somebody please help me with PHP code parsing. I want to be able to extract class names from PHP code:

    Examples:

    class Myclass1 extends Mybaseclass { // match is Myclass1 Mybaseclass


    class Myclass2 // match is Myclass2 null
    {


    class Template extends BaseTemplate implements iTemplate // match is Template BaseTemplate



    /* class ABC { // not a match
    public $MyProperty = 1;
    } */


    " class ABC { // not a match
    public $MyProperty = 1;
    } "
    .
    .
    .
    etc

    Thanks
     
    nihcer, Nov 7, 2009 IP
  2. Pudge1

    Pudge1 Well-Known Member

    Messages:
    912
    Likes Received:
    6
    Best Answers:
    1
    Trophy Points:
    140
    Digital Goods:
    1
    #2
    Can you explain more what you are trying to say please.
     
    Pudge1, Nov 7, 2009 IP
  3. nihcer

    nihcer Member

    Messages:
    30
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #3
    I have a library of over 100 classes. Some of them are stored 1 class per file other are inside one file(multiple classes in 1 file). I want to find out all the names of these classes and the names of their parent classes without executing the whole library. I also want to exclude commented classes and string inside quotes.
     
    nihcer, Nov 8, 2009 IP