Board Thread:Support Requests - Getting Technical/@comment-3271569-20140924153230/@comment-3271569-20140928142104

Tjcool007 wrote: You'd need to create a RegExp object:

Seems to be an error in the code. I doesn't seem to work.

452 wrote: Yes.


 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions

function getdata(data, str) { var myRe = new RegExp(str, 'i'); return data.match(str)[1] } $.get( "http://leagueoflegends.wikia.com/wiki/Template:Data_Lucian?action=raw", function( data ) {  console.log(getdata(data, "\\|range=(.*?)\\|" )) });

edit: fixed example. Seems to work great. Thx