/pattern/flags
- pattern
- The text of the regular expression.
- flags
- If specified, flags can have any combination of the following values:
- g
- global match
- 找全部。因為 REGEX 預設碰到第一個符合的內容就結束比對。
- i
- ignore case 勿略大小寫。
- m
- Treat beginning and end characters (^ and $) as working over multiple lines (i.e., match the beginning or end of each line (delimited by \n or \r), not only the very beginning or end of the whole input string)
* Reference
- RegExp | MDN
- 石頭閒語:Regular Expression (RegExp) in JavaScript - 樂多日誌
沒有留言:
張貼留言