Weird Function String behaviour

Weird Function String behaviour

112
Power UserPower User
112

    Apr 21, 2006#1

    In UE 12.00+3, the following Function String will find certain C++ methods, class methods with the class name separated by the ::

    /Function String = "%[ ^t]++[a-zA-Z_0-9*]+[ ^t]+^([a-zA-Z_0-9]+::[a-zA-Z_0-9^~]+[ ^t^p]++([^p*&, ^t^[^]/*^-'=:&a-zA-Z_0-9./(!]++)^)[~;]"

    Will find: Classname::methodname()

    It occurred to me that there might be leading or trailing whitespace around the :: so I changed :: to:
    [ ^t]++::[ ^t]++
    It seriously broke things!

    Lots of experimenting showed [ ]++:: also doesn't work, but removing the squared brackets will detect leading blanks before the ::
    ^t++:: will work for leading tabs

    What's going on? Is it yet another bug in Regular Expression processing?

    Is it possible to add generalised whitespace around the :: in any way?

    Help!

    Paolo
    There is no such thing as an inconsistently correct system...
    Therefore, aim for consistency; in the expectation of reaching correctness!

    6,675585
    Grand MasterGrand Master
    6,675585

      Apr 22, 2006#2

      I played a lot with it to find out why it fails. This is not a bug in the regular expression processing. The modified regular expression strings works fine if used in the find dialog.

      The problem is that the maximum length for the function string is 119 characters (without the surrounding ""). If the function string gets longer, UE ignores it. This is not documented anywhere and I have not knew it until today too. If you replace :: by [ ^t]++::[ ^t]++ the function string length increases from 115 to 129.

      So you have to shorten the function string. For example you could shorten the (...) part:

      /Function String = "%[ ^t]++[a-zA-Z_0-9*]+[ ^t]+^([a-zA-Z_0-9]+[ ^t]++::[ ^t]++[a-zA-Z_0-9^~]+[ ^t^p]++([~)]++)^)[~;]"

      Add ^p after ~) if you do not have or will not allow multiline parameters.

      Or you ask IDM for an increase of the maximum function string length in a future release.

      Note: The limit of a maximum length of 119 characters was abolished in UE v13.00 and UES v6.20. No new limit is known yet (2009-08-02).
      Best regards from an UC/UE/UES for Windows user from Austria

      112
      Power UserPower User
      112

        Apr 23, 2006#3

        Thanks Mofi,

        I knew you'd get to the bottom of it! 8)

        It's surprising that in in this day and age, boundary problems still go uninstrumented. That is, if there is a fixed limit, the user should be notified when the limit is reached or exceeded.

        I'll put in a bug report and a request to up the size. Bug reported and request made to increase buffer size to 256.

        Paolo
        There is no such thing as an inconsistently correct system...
        Therefore, aim for consistency; in the expectation of reaching correctness!