It seems that V1 has compromised in order to maintain compatibility, but V2 has given up compatibility with v1. Why not unify their behavior?
![Question :?:](./images/smilies/icon_question.gif)
I do support ur point. I, for one, would like all that stuff to follow the same design rule.
The pattern is not always so simple, thus the result is not always a simple string. An object is used to capture the various aspects of the match (captured subpatterns, for example). In the thread I linked in my prior post, fincs suggested having it return the match object, and lexikos pointed out the reasons why he is not implementing that suggestion — largely for performance reasons.
To return the whole string for simple patterns (=Match.Value(0)) or the first captured group inside () (=Match.Value(1)) or NULL (empty string) if none found.
The expected result is a value indicating whether the RegEx matches. If it returned the overall matched value, it would not be a boolean value, so statements such as if RegExMatch(haystack, pattern) would be unreliable. Patterns can match strings of zero digits or of zero length.
Possibility to choose would confuse some.
Return to “AutoHotkey Development”
Users browsing this forum: No registered users and 26 guests