php - validate sms template using preg_match

I want to validate content against the pattern. The pattern has got multiple variable. Each variable is of 30 characters. To increase the length of the variable we repeat{#var#}
multiple times.preg_match
helped me when both content and pattern were static strings. Now, I am facing difficulty when I try to pass the dynamic content.
content = Dear customer, your otp is e9(3>D5. Thanks
pattern = Dear customer, your otp is {#var#}. Thanks
This is the code I tried with, but no success when added variables. Looking for only php or javascript code
$content = '#Dear customer, your otp is e9(3>D5. Thanks#';
$pattern = '#Dear customer, your otp is <input type="text" id="otp" name="otp" value="" maxlength="30">. Thanks#';
echo preg_match($pattern, $content);
thanks in advance
Answer
Solution:
What about something like this:/#Dear customer, your otp is ([a-zA-Z0-9()<>.]{1,30}) Thanks#/
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: call to a member function store() on null
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.