diff --git a/VideoNodes/FfmpegBuilderNodes/FfmpegBuilderTrackSorter.cs b/VideoNodes/FfmpegBuilderNodes/FfmpegBuilderTrackSorter.cs
index 8cfc2ea2..ef7cb64f 100644
--- a/VideoNodes/FfmpegBuilderNodes/FfmpegBuilderTrackSorter.cs
+++ b/VideoNodes/FfmpegBuilderNodes/FfmpegBuilderTrackSorter.cs
@@ -1,5 +1,6 @@
using System.Globalization;
using FileFlows.VideoNodes.FfmpegBuilderNodes.Models;
+using FileFlows.VideoNodes.Helpers;
namespace FileFlows.VideoNodes.FfmpegBuilderNodes;
@@ -294,7 +295,7 @@ public class FfmpegBuilderTrackSorter : FfmpegBuilderNode
}
else if (IsMathOperation(comparison))
result = ApplyMathOperation(value.ToString(), comparison) ? 0 : 1;
- else if (IsRegex(comparison))
+ else if (GeneralHelper.IsRegex(comparison))
result = Regex.IsMatch(value.ToString(), comparison, RegexOptions.IgnoreCase) ? 0 : 1;
else if (value != null && double.TryParse(value.ToString(), out double dbl))
result = dbl;
@@ -456,16 +457,6 @@ public class FfmpegBuilderTrackSorter : FfmpegBuilderNode
// Check if the comparison string starts with <=, <, >, >=, ==, or =
return new[] { "<=", "<", ">", ">=", "==", "=" }.Any(comparison.StartsWith);
}
-
- ///
- /// Checks if the comparison string represents a regular expression.
- ///
- /// The comparison string to check.
- /// True if the comparison is a regular expression, otherwise false.
- private static bool IsRegex(string comparison)
- {
- return new[] { "?", "|", "^", "$" }.Any(ch => comparison.Contains(ch));
- }
///
/// Applies a mathematical operation to the value based on the specified operation string.
diff --git a/VideoNodes/Helpers/GeneralHelper.cs b/VideoNodes/Helpers/GeneralHelper.cs
new file mode 100644
index 00000000..ec9aba71
--- /dev/null
+++ b/VideoNodes/Helpers/GeneralHelper.cs
@@ -0,0 +1,17 @@
+namespace FileFlows.VideoNodes.Helpers;
+
+///
+/// General helper
+///
+public class GeneralHelper
+{
+ ///
+ /// Checks if the input string represents a regular expression.
+ ///
+ /// The input string to check.
+ /// True if the input is a regular expression, otherwise false.
+ public static bool IsRegex(string input)
+ {
+ return new[] { "?", "|", "^", "$" }.Any(ch => input.Contains(ch));
+ }
+}
\ No newline at end of file
diff --git a/VideoNodes/LogicalNodes/VideoHasStream.cs b/VideoNodes/LogicalNodes/VideoHasStream.cs
index 537d8983..c3c3e812 100644
--- a/VideoNodes/LogicalNodes/VideoHasStream.cs
+++ b/VideoNodes/LogicalNodes/VideoHasStream.cs
@@ -1,5 +1,6 @@
using FileFlows.VideoNodes.FfmpegBuilderNodes;
using FileFlows.VideoNodes.FfmpegBuilderNodes.Models;
+using FileFlows.VideoNodes.Helpers;
namespace FileFlows.VideoNodes;
@@ -209,14 +210,20 @@ public class VideoHasStream : VideoNode
if (string.IsNullOrEmpty(value))
return MatchResult.NoMatch;
- var rgx = new Regex(pattern, RegexOptions.IgnoreCase);
- if(rgx.IsMatch(value))
- return MatchResult.Matched;
+
+ if (GeneralHelper.IsRegex(pattern))
+ {
+ var rgx = new Regex(pattern, RegexOptions.IgnoreCase);
+ if (rgx.IsMatch(value))
+ return MatchResult.Matched;
+ }
if (value.ToLower() == "hevc" && (pattern.ToLower() == "h265" || pattern == "265" || pattern.ToLower() == "h.265"))
return MatchResult.Matched; // special case
- return MatchResult.NoMatch;
+ return pattern.ToLowerInvariant().Trim() == value.ToLowerInvariant().Trim()
+ ? MatchResult.Matched
+ : MatchResult.NoMatch;
}
catch (Exception)
{