Highlight template code

Today, an frontend developer want to implement an effect — to highlight template code. As an example, we need to transfer string like  "dfasf${1}${2tes}dfsdf${hello3}blabla"  to an array like:

Here is my solution (in JavaScript):

This function will return an array as we mentioned above.

发表评论

电子邮件地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据