正規表達式(正則表達式) (Regular Expression, regex)
正規表達式撰寫方法有兩種
var re = /ab+c/; => 在 script 載入時會被編譯,當正規表達式為定值時,使用此方法可獲得較佳效能。
var re = new RegExp('ab+c'); => 即時編譯正則表達式,當模式會異動、事先未知匹配模式、或者您將從其他地方取得時,使用建構子函數將較為合適。
線上練習網站
https://regex101.com/
regex101的切換語系
網站預設為英文語系,不過可以切換成簡體中文
進入網站後,點選左邊的扳手icon,然後選擇語系為chinese就可以。
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
參考文獻
[JavaScript] 來寫正規表達式 Regex
簡易 Regular Expression 入門指南
文本分析基礎-正規表達式(RegExp)
[JS]正規表示法:表單驗證
正規表示法 Regular Expression (Regex)
[Javascript] 初探Regex 正規表達式
[JS] 正則表達式(Regular Expression, regex)