diff --git a/app/Services/Automation/AutomationSender.php b/app/Services/Automation/AutomationSender.php index 2b7f450..1efbb8b 100644 --- a/app/Services/Automation/AutomationSender.php +++ b/app/Services/Automation/AutomationSender.php @@ -142,8 +142,9 @@ class AutomationSender ]); // الگوی پیامک/تنظیمات: %نام ، ٪نام ، % name ، %name% - $out = preg_replace('/[%٪]\s*(?:name|نام)[%٪]?/iu', $name, $out) ?? $out; + // نام_کوچک قبل از نام — وگرنه %نام داخل %نام_کوچک زودتر match می‌شود $out = preg_replace('/[%٪]\s*(?:fname|نام_کوچک|نام‌کوچک)[%٪]?/iu', $fname, $out) ?? $out; + $out = preg_replace('/[%٪]\s*(?:name|نام)(?![_‌]?کوچک)[%٪]?/iu', $name, $out) ?? $out; $out = preg_replace('/[%٪]\s*(?:mobile|موبایل)[%٪]?/iu', $mobile, $out) ?? $out; return $out;