Regex between words

3

I'm trying to make a query Regex that returns me in a source code file statements that are not public %%Enum Tipo , however I'm not very familiar with Regex and I'm having a bit of trouble, hint how you can do this.

Basically this Regex would have to return the statements to me:

public int Tipo
public int16 Tipo

that is, all type does not end with Enum such as:

public CaixaTipoEnum Tipo
    
asked by anonymous 17.11.2014 / 18:03

2 answers

3

You can use the following expression ^(public|private)((?!Enum).)*$ .

I used a regular expression tester online Click here ,

paste the expression there and you can test it.

    
17.11.2014 / 18:25
1

Crude strength has never failed me.

First you get all member declarations with the expression:

(public|private) .+?;

Put this in a list. Then, over the list, you get the ones that you do not want with the expression:

Enum

Yes, that's the way it is.

Now just get all the elements that are part of the first list, but that are not part of the second;)

    
17.11.2014 / 18:14