Regex help
Posted: August 7th, 2009, 7:00 pm
I'm trying to tweak a greasemonkey script, and i'm having trouble with the regex of part of it, and wondered if anyone could help.
Here's the original
But the results of the info from the imdb page come up as
cation:
Iceland:16 | South Korea:15 | Argentina:16 | Australia:MA | Belgium:KT | Canada:13+ (Quebec) | Canada:14A (Alberta/British Columbia) | Canada:14 (Nova Scotia) | Canada:AA (Ontario) | Canada:PA (Manitoba) | Chile:14 | Finland:K-16 | France:U | Germany:12 | Hong Kong:IIB | Ireland:18 | Netherlands:16 | Portugal:M/16 | Singapore:M18 | Spain:13 | Sweden:15 | Switzerland:12 (canton of Geneva) | Switzerland:12 (canton of Vaud) | UK:15 | USA:R
Ideally, i'd like it to only show whatever is after USA: (in this example the letter "R")
Can someone help me with the code? Thanks
Here's the original
Code: Select all
this.getGenre = function(text, report) {
var match = text.match(/Certification:[^<>]*([^]*?)(?=<\/div>)/);
if(match) {
genre = match[0].replace(/(<([^>]+)>)/ig,"").substring(7);
genre = genre.replace("more", "");
return genre;
}
return null;
}
cation:
Iceland:16 | South Korea:15 | Argentina:16 | Australia:MA | Belgium:KT | Canada:13+ (Quebec) | Canada:14A (Alberta/British Columbia) | Canada:14 (Nova Scotia) | Canada:AA (Ontario) | Canada:PA (Manitoba) | Chile:14 | Finland:K-16 | France:U | Germany:12 | Hong Kong:IIB | Ireland:18 | Netherlands:16 | Portugal:M/16 | Singapore:M18 | Spain:13 | Sweden:15 | Switzerland:12 (canton of Geneva) | Switzerland:12 (canton of Vaud) | UK:15 | USA:R
Ideally, i'd like it to only show whatever is after USA: (in this example the letter "R")
Can someone help me with the code? Thanks