Get The Full Path Of All Files Of Some Types From A Html File And Put Them Into An Array Using Js/jquery
I need to get the paths from something like this:
level/thing.mp3
- <
Solution 1:
Since .*
grabs as many matching characters as it can, you need to be more specific about what can and can't be in the middle.
Try:
var res = str.match(/https?:\/\/\S+\.flv/gi);
where \S
grabs as many non-whitespace characters as it can.
To exclude certain characters, use [^...]
:
var res = str.match(/https?:\/\/[^\s;]+\.flv/gi);
Alternatively, just make your .*
lazy instead of greedy with a well-placed ?
:
var res = str.match(/http.*?\.flv/gi);
Post a Comment for "Get The Full Path Of All Files Of Some Types From A Html File And Put Them Into An Array Using Js/jquery"