Created
April 2, 2015 03:29
-
-
Save campanalbero/f2dd83dc133447ab1b65 to your computer and use it in GitHub Desktop.
regexp-sample
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
var uri = "http://localhost:8080/reinput?key=1234-5678-90ab-cdef"; | |
var reg = /\\??key=[0-9a-f\\-]+/; | |
if (uri.match(reg)) { | |
console.log("matched"); | |
var replaced = uri.replace(reg, "key=hoge"); | |
console.log(replaced); | |
} else { | |
console.log("unmatched"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment