Created
January 7, 2010 19:32
-
-
Save mashiro/271490 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| string text = "source text"; | |
| Match match = null; | |
| List<Func<bool>> funcs = new List<Func<bool>>() { | |
| () => { match = Regex.Match(text, "pattern1"); return match.Success; }, | |
| () => { match = Regex.Match(text, "pattern2"); return match.Success; }, | |
| () => { match = Regex.Match(text, "pattern3"); return match.Success; }, | |
| () => { match = Regex.Match(text, "pattern4"); return match.Success; }, | |
| () => { match = null; return true; } | |
| }; | |
| funcs.TakeWhile(f => !f()).ToList(); | |
| if (match == null) throw new Exception("no match"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment