mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-25 20:52:44 +01:00
Reduce nesting
This commit is contained in:
parent
2a525fcfd8
commit
0135f32649
@ -1961,18 +1961,21 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
|
||||
public static bool IsValidRegex(string testPattern)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(testPattern))
|
||||
if (string.IsNullOrEmpty(testPattern))
|
||||
{
|
||||
try
|
||||
{
|
||||
Regex.Match("", testPattern);
|
||||
return true;
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{ // BAD PATTERN: Syntax error
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
Regex.Match("", testPattern);
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
// BAD PATTERN: Syntax error
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static Regex MakeWordSearchRegex(string word)
|
||||
|
Loading…
Reference in New Issue
Block a user