diff --git a/scripts/install b/scripts/install
index f5e8814..4980e9f 100755
--- a/scripts/install
+++ b/scripts/install
@@ -34,7 +34,7 @@ path_without_trailing_slash=${path%/}
ynh_replace_string --match_string="" --replace_string="" --target_file="$install_dir/index.html"
# patching main.dart.js to replace the default matrix server
-ynh_replace_string --match_string="\$\.cmx=\"matrix.org\"" --replace_string="\$\.cmx=\"$default_matrix_server\"" --target_file="$install_dir/main.dart.js"
+ynh_replace_string --match_string="=\"matrix.org\"" --replace_string="=\"$default_matrix_server\"" --target_file="$install_dir/main.dart.js"
chown -R "www-data:www-data" "$install_dir"
diff --git a/scripts/upgrade b/scripts/upgrade
index 06397c0..442dc95 100755
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -35,7 +35,7 @@ then
ynh_replace_string --match_string="" --replace_string="" --target_file="$install_dir/index.html"
# patching main.dart.js to replace the default matrix server
- ynh_replace_string --match_string="\$\.cmx=\".*\"" --replace_string="\$\.cmx=\"$default_matrix_server\"" --target_file="$install_dir/main.dart.js"
+ ynh_replace_string --match_string="=\"matrix.org\"" --replace_string="=\"$default_matrix_server\"" --target_file="$install_dir/main.dart.js"
fi
chown -R "www-data:www-data" "$install_dir"