I am using liquid inside html editor.
I have issue when I do copy paste or different cases I have issue.
var str = "{% if user.firstName = 'joe' || user.firstName = 'ben' %}"; console.log(str.replace(/(\\{)\\s*(\\S+)\\s*(?=})/img, "$1$2"));
It should output:
{% if user.firstName = 'joe' || user.firstName = 'ben' %}
I've tried : str.replace(/(\\{)\\s*(\\S+)\\s*(?=})/img, "$1$2");
Regex to replace non breaking spaces
var r = new RegExp('( )','g');
var s = "{% if user.firstName = 'joe' || user.firstName = 'ben' %}"
console.log(s.replace(r,''));
// {% if user.firstName = 'joe' || user.firstName = 'ben' %}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.