[我在格式化xml代码时使用了以下javascript替换功能。
xml = xmll.replace(/<\/?[0-9]{1,}>/g, '');
但是即使我也使用以下功能来创建新行,也不会创建换行符。
xml = xmll.replace(/<\/?[0-9]{1,}>/g, '\n');
仍然在关闭xml标签后没有创建换行符或换行。有人知道应该怎么做吗?
尝试一下。
xml = xmll.replace(/(<\/?.*?>)/g, '$1\n');