Perl regexp function list for C#

Perl regexp function list for C#

344
MasterMaster
344

    Feb 26, 2009#1

    Hi guys,

    I want to specify a Perl-style function list that works for C#.
    I read some articles here and came closer, but I can't get it to work 100%
    Best I post a self-explaining example and let the Tim/Mofi/Jo - crew take a minute on it.

    Code: Select all

    thisNot (private asdasd, asds)
    
      private override string ThisYes(blubb dada)
    
    	private virtual string ThisYes2(blubb, dada)
    
    protected abstract anythingElse int[] ThisYes3withBlank (blubb dada, lulu sipp) thisnomore {
    
    public abstract object ThisToo4
      
    bi bla blubb ThisNot(blubb dada, lulu sipp) sdfsdf wsf sd 
    bi bla blubb ThisNot2(blubb dada, lulu sipp)
    Rule: (private|public|protected) must be the first word in the line.
    Match the word before the first ( and mark it till the last ) in the line.
    If no (), take the last word.
    Any help appreciated. Tim, für dich sicher ne Fingerübung ;-) Greetz nach Ulm

    rds Bego
    Normally using all newest english version incl. each hotfix. Win 10 64 bit

    6,602548
    Grand MasterGrand Master
    6,602548

      Feb 27, 2009#2

      Hi Bego,

      with UE v14.20.1.1008 following worked in the syntax highlighting wordfile for your example:

      /Regexp Type = Perl
      /Function String = "^[ \t]*(
      ?:private|protected|public).*[ \t]+([0-9_a-z]+)[ \t]*(?:\(|$)"

      This Perl function string creates a function list showing:

      ThisToo4
      ThisYes
      ThisYes2
      ThisYes3withBlank

      Without ?: in the regular expression the function list shows:

      private ThisYes
      private ThisYes2
      protected ThisYes3withBlank
      public ThisToo4

      It was really surprising for me to see different strings in the found lines in the function list without showing the entire line. The Perl regular expression engine is really cool.

      Sorry, I have just seen that you want to see also the parameters of the functions in the function list.

      /Regexp Type = Perl
      /Function String = "^[ \t]*(
      ?:private|protected|public).*[ \t]+([0-9_a-z]+[ \t]*\(.*\))"
      /Function String 1 = "^[ \t]*(
      ?:private|protected|public).*[ \t]+([0-9_a-z]+)[ \t]*$"

      or even better

      /Regexp Type = Perl
      /Function String = "^[ \t]*(
      ?:private|protected|public).*[ \t]+([0-9_a-z]+)[ \t]*(\(.*\))"
      /Function String 1 = "^[ \t]*(
      ?:private|protected|public).*[ \t]+([0-9_a-z]+)[ \t]*$"

      The last one results in having always exactly 1 space between the function name and (...) in the function list.
      Best regards from an UC/UE/UES for Windows user from Austria

      344
      MasterMaster
      344

        Feb 27, 2009#3

        Hallo Mofi,

        A fat Danke towards Austria from me. I made a mistake in my regex, which was just too complicated.... Thanks you!
        Yes, Perl regexp is really cool. But when I think I understood everything, after some weeks some rework must be done to get back on track ;-)
        Regex-Buddy is also an awesome help btw., I think I mentioned it once before.

        rds Bego
        Normally using all newest english version incl. each hotfix. Win 10 64 bit