2013年7月31日 星期三

Use Regex to match a string in Javascript

I use the following line to capture a JS link in a string:

var url = req.responseText.match(/http:.*js/);

For more information and usage, find the reference links for deftails.

Reference links
http://stackoverflow.com/questions/1707299/how-to-extract-a-string-using-javascript-regex
http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_match_regexp

沒有留言:

張貼留言