Merge pull request #104542 from bruvzg/rtl_fix_fx_regex

[RTL] Fix `float` and `int` matching in FX environment.
This commit is contained in:
Thaddeus Crews 2025-03-24 10:00:52 -05:00
commit 9a0ea64bd6
No known key found for this signature in database
GPG key ID: 62181B86FE9E5D84

View file

@ -6954,10 +6954,10 @@ Dictionary RichTextLabel::parse_expressions_for_values(Vector<String> p_expressi
nodepath.compile("^\\$");
RegEx boolean = RegEx();
boolean.compile("^(true|false)$");
RegEx decimal = RegEx();
decimal.compile("^-?^.?\\d+(\\.\\d+?)?$");
RegEx numerical = RegEx();
numerical.compile("^\\d+$");
numerical.compile("^[-+]?\\d+$");
RegEx decimal = RegEx();
decimal.compile("^[+-]?\\d*(\\.\\d*)?([eE][+-]?\\d+)?$");
for (int j = 0; j < values.size(); j++) {
if (color.search(values[j]).is_valid()) {
@ -6973,10 +6973,10 @@ Dictionary RichTextLabel::parse_expressions_for_values(Vector<String> p_expressi
} else if (values[j] == "false") {
a.append(false);
}
} else if (decimal.search(values[j]).is_valid()) {
a.append(values[j].to_float());
} else if (numerical.search(values[j]).is_valid()) {
a.append(values[j].to_int());
} else if (decimal.search(values[j]).is_valid()) {
a.append(values[j].to_float());
} else {
a.append(values[j]);
}