Reduce nesting

This commit is contained in:
_aLfa_ 2014-09-21 13:13:49 +02:00
parent 2a525fcfd8
commit 0135f32649

View File

@ -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)