Skip to content

Commit 012c771

Browse files
committed
assets: Fix query containing dashes and underscores.
1 parent 21a1544 commit 012c771

File tree

1 file changed

+9
-1
lines changed
  • VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser

1 file changed

+9
-1
lines changed

VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetQuery.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,15 @@ public void Search(string q)
4949
{
5050
// parse attributes
5151
_attributes.Clear();
52-
foreach (var regex in new []{ new Regex(@"(\w+):(\w+)"), new Regex("\"([\\w\\s]+)\":(\\w+)"), new Regex("(\\w+):\"([\\w\\s]+)\""), new Regex("\"([\\w\\s]+)\":\"([\\w\\s]+)\"") }) {
52+
const string quoted = "\"([\\w\\d\\s_-]+)\"";
53+
const string nonQuoted = "([\\w\\d_-]+)";
54+
var regexes = new[] {
55+
new Regex($"{nonQuoted}:{nonQuoted}"),
56+
new Regex($"{quoted}:{nonQuoted}"),
57+
new Regex($"{nonQuoted}:{quoted}"),
58+
new Regex($"{quoted}:{quoted}")
59+
};
60+
foreach (var regex in regexes) {
5361
foreach (Match match in regex.Matches(q)) {
5462
var key = match.Groups[1].Value;
5563
if (!_attributes.ContainsKey(key)) {

0 commit comments

Comments
 (0)