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.
var alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
我怎样才能删除和之间的所有内容H,S以便结果是ABCDEFGHSTUVWXYZ?
H
S
ABCDEFGHSTUVWXYZ
var alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; console.log( alphabet.replace(/H.*S/, 'HS') )
要不就:
var alphabet = "ABCDEFGHSTUVWXYZ";
var strippedAlphabet = alphabet.replace(/H.*S/, 'HS');