Created
July 21, 2015 10:02
-
-
Save MicroHank/9d2e6fa0f345cdc40f89 to your computer and use it in GitHub Desktop.
Javascript 正規式函數 match 使用自訂參數
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[成功] | |
filter是要過濾的字串開頭 | |
var regrule = new RegExp('^'+filter, "g") ; | |
string.match(regrule) ; | |
[錯誤] | |
string.match(/^filter/) ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment