public void GetRegexOptions() { var opts = MiscellaneousUtils.GetRegexOptions("imsxRUBBISH"); Assert.AreEqual(opts, RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.ExplicitCapture); }
private object ReadRegexString(JsonReader reader) { string regexText = (string)reader.Value; int patternOptionDelimiterIndex = regexText.LastIndexOf('/'); string patternText = regexText.Substring(1, patternOptionDelimiterIndex - 1); string optionsText = regexText.Substring(patternOptionDelimiterIndex + 1); RegexOptions options = MiscellaneousUtils.GetRegexOptions(optionsText); return(new Regex(patternText, options)); }
// Token: 0x06001473 RID: 5235 RVA: 0x0006C7EC File Offset: 0x0006A9EC private static bool RegexEquals(JValue input, JValue pattern) { if (input.Type != JTokenType.String || pattern.Type != JTokenType.String) { return(false); } string text = (string)pattern.Value; int num = text.LastIndexOf('/'); string pattern2 = text.Substring(1, num - 1); string optionsText = text.Substring(num + 1); return(Regex.IsMatch((string)input.Value, pattern2, MiscellaneousUtils.GetRegexOptions(optionsText))); }
private static bool RegexEquals(JValue input, JValue pattern) { if (input.Type == JTokenType.String) { if (pattern.Type == JTokenType.String) { string value = (string)pattern.Value; int num = value.LastIndexOf('/'); string str = value.Substring(1, num - 1); string str1 = value.Substring(num + 1); return(Regex.IsMatch((string)input.Value, str, MiscellaneousUtils.GetRegexOptions(str1))); } } return(false); }
private object ReadRegexString(JsonReader reader) { string value = (string)reader.Value; if (value.Length > 0 && value[0] == '/') { int num = value.LastIndexOf('/'); if (num > 0) { string str = value.Substring(1, num - 1); RegexOptions regexOptions = MiscellaneousUtils.GetRegexOptions(value.Substring(num + 1)); return(new Regex(str, regexOptions)); } } throw JsonSerializationException.Create(reader, "Regex pattern must be enclosed by slashes."); }
private object ReadRegexString(JsonReader reader) { string regexText = (string)reader.Value !; if (regexText.Length > 0 && regexText[0] == '/') { int patternOptionDelimiterIndex = regexText.LastIndexOf('/'); if (patternOptionDelimiterIndex > 0) { string patternText = regexText.Substring(1, patternOptionDelimiterIndex - 1); string optionsText = regexText.Substring(patternOptionDelimiterIndex + 1); RegexOptions options = MiscellaneousUtils.GetRegexOptions(optionsText); return(new Regex(patternText, options)); } } throw JsonSerializationException.Create(reader, "Regex pattern must be enclosed by slashes."); }