Validate Merge Field Placeholders In Email Templates
Last updated: November 29, 2026
Quick Overview
Zoho CRM email templates contain placeholders like ${Contact.First_Name}. Write a validator that returns the position and reason for every placeholder that is unclosed or whose field name is not a dotted identifier.
Zoho
November 29, 20260
0
0 solved
Zoho CRM email templates contain placeholders like ${Contact.First_Name}. Write a validator that returns the position and reason for every placeholder that is unclosed or whose field name is not a dotted identifier.
Templates in Zoho CRM, Campaigns and Books all substitute record fields into text, and a broken placeholder means a customer email goes out with raw syntax in it. The interviewer is checking scanning logic, clear error reporting and how you define a valid name.
What the Interviewer Expects
- Scan left to right and detect the ${ opener
- Treat a new opener before a closer as an unclosed placeholder
- Validate names with a precise rule (dotted identifiers)
- Report all errors with positions, not just the first
- Keep plain text, including a lone $ or }, valid
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you also check that the field actually exists in the module schema?
- How would you support a default value syntax like ${Contact.First_Name|there}?
- How would you render the template once it validates?
- How would you make error positions line and column based for the editor?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
A placeholder starts at ${ and ends at the next }. Its trimmed inner text must match Module.Field style identifiers (letters, digits, underscore, dots between parts). Return a list of `(index, m...
High-Level Design
Linear scan. At each ${, look for the next } and the next ${. If there is no closer, or another opener comes first, the placeholder is unclosed: record it and resume just after this opener so th...