diff --git a/rules_shipping_advanced.php b/rules_shipping_advanced.php
index 1d68c1829304921b62b865558c5a4c67e8183ded..3d81055e9ee070b7bafca77af64324bc3bd32ccb 100644
--- a/rules_shipping_advanced.php
+++ b/rules_shipping_advanced.php
@@ -180,8 +180,8 @@ class ShippingRule_Advanced extends ShippingRule {
 
 		
 		// Special-case the name assignment, where we don't want to interpret the value as an arithmetic expression!
-		if (preg_match('/^\s*(name)\s*=\s*"?(.*)"?\s*$/i', $rulepart, $matches)) {
-			$this->handleAssignment ($matches[1], $matches[2], $rulepart);
+		if (preg_match('/^\s*(name)\s*=\s*(["\']?)(.*)\2\s*$/i', $rulepart, $matches)) {
+			$this->handleAssignment ($matches[1], $matches[3], $rulepart);
 			return;
 		}