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.
「[]」内に部分文字列を含む自動生成テキストがあります。
例えば:
data[0]['x'][1]['y']
最後の部分文字列を取り除きたい。
出力:
data[0]['x'][1]
何か案は?
var result = input.replace( /\[[^\]]*\]$/, '' )
トリックを行います