--- tags: Javascript, disqus: hackmd --- # 正規表達式(正則表達式) (Regular Expression, regex) 正規表達式撰寫方法有兩種 var re = /ab+c/; => 在 script 載入時會被編譯,當正規表達式為定值時,使用此方法可獲得較佳效能。 var re = new RegExp('ab+c'); => 即時編譯正則表達式,當模式會異動、事先未知匹配模式、或者您將從其他地方取得時,使用建構子函數將較為合適。 --- #### 線上練習網站 https://regex101.com/ #### regex101的切換語系 網站預設為英文語系,不過可以切換成簡體中文 進入網站後,點選左邊的扳手icon,然後選擇語系為chinese就可以。   --- ## 參考文獻 [[JavaScript] 來寫正規表達式 Regex](https://medium.com/itsems-frontend/whats-regex-dc08c8c30a87) [簡易 Regular Expression 入門指南](https://github.com/aszx87410/blog/issues/58) [文本分析基礎-正規表達式(RegExp)](https://kopu.chat/2017/01/18/%E6%96%87%E6%9C%AC%E5%88%86%E6%9E%90%E5%9F%BA%E7%A4%8E-%E6%AD%A3%E8%A6%8F%E8%A1%A8%E9%81%94%E5%BC%8Fregexp/) [[JS]正規表示法:表單驗證](https://jonas1011.pixnet.net/blog/post/26065399) [正規表示法 Regular Expression (Regex)](https://www.fooish.com/regex-regular-expression/) [[Javascript] 初探Regex 正規表達式](https://medium.com/@moojing/javascript-%E5%88%9D%E6%8E%A2regex-%E6%AD%A3%E8%A6%8F%E8%A1%A8%E9%81%94%E5%BC%8F-1da2f4d94795) [[JS] 正則表達式(Regular Expression, regex)](https://pjchender.github.io/2017/09/26/js-%E6%AD%A3%E5%89%87%E8%A1%A8%E9%81%94%E5%BC%8F-regular-expression-regex/)
×
Sign in
Email
Password
Forgot password
or
Sign in via Google
Sign in via Facebook
Sign in via X(Twitter)
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
Continue with a different method
New to HackMD?
Sign up
By signing in, you agree to our
terms of service
.