This might sound like a stupid question, but I had a long talk with some of my fellow developers and it sounded like a fun thing to think of.
So; what's your thought - what does a Regex look like, that will never be matched by any string, ever!
Edit: Why I want this? Well, firstly because I find it interesting to think of such an expression and secondly because I need it for a script.
In that script I define a dictionary as Dictionary<string, Regex>
. This contains, as you see, a string and an expression.
Based on that dictionary I create methods that all use this dictionary as only reference on how they should do their work, one of them matches the regexes against a parsed logfile.
If an expression is matched, another Dictionary<string, long>
is added a value that is returned by the expression. So, to catch any log-messages that are not matched by an expression in the dictionary I created a new group called "unknown".
To this group everything that didn't match anything other is added. But to prevent the "unknown"-expression to mismatch (by accident) a log-message, I had to create an expression that is most certainly never matched, no matter what string I give it.
Thus, there you have my reason for this "not a real question"...
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…