0
이중 복사를 제거하기 위해 스크립트를 사용했습니다. 그러나이 스크립트는 공간과 함께 새 줄을 제거합니다.이중 줄은 제거하지만 새 줄은 지우지 않습니다.
Suppose Input is "\s\s\n\n" Script's output is "\s" Desired Output "\s\n\n" That I simply want to remover double space but not new line. Want to skip new line.당신은 공백을 expunges
\s
을 사용하고
function clean(f) { f.value=f.value.replace(/^\s+|\s+$/g,'').replace(/\s\s+/g,' '); return true; }
'\ s'는 \ t \ 없음의 \의 V \ F \ r''일치합니다. https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/RegExp#endnote_equivalent_s –
'\ s'는 공백 문자 (문자 이스케이프 섹션 참조)] (http://www.javascriptkit.com /javatutors/redev2.shtml), 줄 바꿈, 탭, 세로줄, 줄 바꿈,'' '등이 있습니다. – jswolf19