mirror of
https://github.com/openbullet/openbullet.git
synced 2023-10-21 07:33:42 -05:00
Refactored previous PR
This commit is contained in:
@@ -309,7 +309,12 @@ namespace RuriLib
|
||||
throw new NotImplementedException("XPATH parsing is not implemented yet");
|
||||
|
||||
case ParseType.REGEX:
|
||||
list = Parse.REGEX(original, ReplaceValues(regexString, data), ReplaceValues(regexOutput, data), recursive, dotMatches, caseSensitive).ToList();
|
||||
RegexOptions regexOptions = new RegexOptions();
|
||||
if (dotMatches)
|
||||
regexOptions |= RegexOptions.Singleline;
|
||||
if (caseSensitive == false)
|
||||
regexOptions |= RegexOptions.IgnoreCase;
|
||||
list = Parse.REGEX(original, ReplaceValues(regexString, data), ReplaceValues(regexOutput, data), regexOptions, recursive).ToList();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -241,17 +241,11 @@ namespace RuriLib.Utils.Parsing
|
||||
/// <param name="pattern">The Regex pattern containing groups</param>
|
||||
/// <param name="output">The output format string, for which [0] will be replaced with the full match, [1] with the first group etc.</param>
|
||||
/// <param name="recursive">Whether to make multiple matches</param>
|
||||
/// <param name="dotMatches">Whether Regex . matches over multiple lines</param>
|
||||
/// <param name="caseSensitive">Whether Regex is case sensitive</param>
|
||||
/// <param name="options">The Regex Options to use</param>
|
||||
/// <returns>The parsed string(s).</returns>
|
||||
public static IEnumerable<string> REGEX(string input, string pattern, string output, bool recursive = false, bool dotMatches = false, bool caseSensitive = true)
|
||||
public static IEnumerable<string> REGEX(string input, string pattern, string output, RegexOptions options, bool recursive = false)
|
||||
{
|
||||
var list = new List<string>();
|
||||
RegexOptions options = new RegexOptions();
|
||||
if (dotMatches)
|
||||
options |= RegexOptions.Singleline;
|
||||
if (caseSensitive == false)
|
||||
options |= RegexOptions.IgnoreCase;
|
||||
|
||||
if (recursive)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user