Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
これは機能せず、私はそれをひどく必要とします
$('some+multi+word+string').replace('+', ' ' );
常に取得します
some multi+word+string
常に最初のインスタンスでのみ置き換えられますが、すべての+シンボルで機能する必要があります。
グローバル(g)フラグを指定できるように、正規表現を使用する必要があります。
var s = 'some+multi+word+string'.replace(/\+/g, ' ');
( jQueryメソッドではないため$()、文字列の周囲を削除したため、まったく機能しません。)replace
$()
replace
'some+multi+word+string'.replace(/\+/g, ' '); ^^^^^^
'g'="グローバル"
乾杯