如题.
2.代码.
<script type="text/javascript"> var name="jjjjjj哈哈jjjjjjjjjjjjjddddddddddddddddddddkkkkkkkkkkkkkkkkkk"; name=name.replace(/([^\n]{20})/g,"$1\n"); alert(name); </script>3.注意. ^\n代表你要插入的字符,这个是"不包含换行符"的意思 . 原文链接:https://www.f2er.com/regex/360987.html