📜  javascript 正则表达式插入字符串 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:04.554000             🧑  作者: Mango

代码示例1
var str = "Tell us about this interaction. Make sure you mention: (a) what the interaction was about (hangout, chit chat, discuss assignments, etc.) (b) what other things you and/or your friend was doing on the phone during this interaction (c) whether both of you were involved in this other activity and (d) any other information about this interaction you would like to share with us. Avoid using your friends full real name";
var pat = /\([a-zA-Z]\)/g;
var out = str.replace(pat, "
$&"); document.write(out);