Guten Tag, ich habe ein RegEx geschrieben durch den ich mediaquerys rausfiltern will die nicht zutreffen: Die MediaQuerys sind:
@media only screen and (max-width : 1500px) { .box2{ height:200px; width:200px; background:green; float:left; margin-left:50px; } }@media only screen and (max-width : 1900px) { .box2{ height:200px; width:200px; background:green; float:left; margin-left:50px; } }@media only screen and (max-width : 2000px) { .box2{ height:200px; width:200px; background:green; float:left; margin-left:50px; } }
und rausgefiltert werden soll alles, was unter 1900px ist . Dafür habe ich folgenden RegEx:
var re_2 = /@.+(max([0-1899])?.*){.+}/g;
while ((Ergebnis = re_2.exec(Aussage)) !== null)
{
$(".boxalert2").append(Ergebnis);
}
dies funktioniert allerdings leider nicht, da er mir immernoch alle MediaQuerys ausgibt und beim letzten MediaQuery(2000px) nach box2 aufhört.
Die Ausgabe:
@media only screen and (max-width : 1500px) { .box2{ height:200px; width:200px; background:green; float:left; margin-left:50px; } }@media only screen and (max-width : 1900px) { .box2{ height:200px; width:200px; background:green; float:left; margin-left:50px; } }@media only screen and (max-width : 2000px) { .box2{ height:200px; width:200px; background:green; float:left; margin-left:50px; } }max-width : 2000px) { .box2
Die Ausgabe die ich haben möchte:
@media only screen and (max-width : 1500px) { .box2{ height:200px; width:200px; background:green; float:left; margin-left:50px; }
Ich habe dieses Beispiel nocheinmal hier dargestellt:
http://jsfiddle.net/Lsm5crm6/