Kata
Trolls are attacking your comment section!
A common way to deal with this situation is to remove all of the vowels from the trolls’ comments, neutralizing the threat.
Your task is to write a function that takes a string and return a new string with all vowels removed.
For example, the string “This website is for losers LOL!” would become “Ths wbst s fr lsrs LL!”.
Note: for this kata y isn’t considered a vowel.
# My Solutions
1 | function disemvowel(str) { |
# Others
정규식으로 풀이
1 | function disemvowel(str) { |
- [xyz] 문자셋(Character set) 매칭되는 것
- [^xyz] 음의 문자셋(negated) or 보수 문자셋(complemented) []안에 있지 않은 문자열과 매칭
- ig 대소문자 둘다
# thoughts
- 우연하게 어제랑 비슷한 유형이라서 바로 정규식으로 풀어봤다.
- String 문제는 정규식으로 푸는게 좋을거 같다.(아직은 정규식 초보)
- replace, split, slice 모두 새로운 값 반환(+반환값들의 형식도 다시 확인)
references
- MDN - String.prototype.replace()
- MDN - String.prototype.slice()
- MDN - String.prototype.split()
- 정규식(Regular Expressions)