Hello!
For some reason I can not run the following regular program on js:
this.getText = function(){ var reg = /(?<=.menu{)[^}]*$/ let text1 = document.getElementById("css-mnu").innerText.search(reg); if (text1 == -1) return NaN; console.log(text1); let spl = text1.split(';'); return spl; } The text itself:
.header{ min-height: 25px; } .header *{ width: 100%; } .menu{ display: inline-flex; flex-direction: rows; justify-content: space-around; } .menu > *{ border: 1px solid; text-align: center; } .menu > *{ border: 1px solid; text-align: center; } .menu *:last-child{ display: none; }
Itself regular - working. Checked in notepad ++, finds no problem. Moreover, if we simplify the regular schedule itself, say to .menu, it also works.
var func = function(){ var reg = /(?<=\.menu\{)[^\}]*$/ let text1 = document.getElementById("css-mnu").innerText.search(reg); if (text1 == -1) { document.write(text1); return NaN; } document.write(text1); let spl = text1.split(';'); return spl; } <div style="border:1px solid;cursor:pointer" onclick=func() id="css-mnu"> /*все элементы меню имеют толщину 100%*/ .header{ min-height: 25px; } .header *{ width: 100%; } .menu{ display: inline-flex; flex-direction: rows; justify-content: space-around; } .menu > *{ border: 1px solid; text-align: center; } .menu > *{ border: 1px solid; text-align: center; } .menu *:last-child{ display: none; } </div> What could be the problem with the full version /(?<=.menu{)[^}]*$/ ?) /(?<=.menu{)[^}]*$/ / /(?<=.menu{)[^}]*$/ ?
Thank you in advance
lookbehinddoesn't work yet injs- ThisMancss-mnu- maybe a typo here should be acss-menu- Evgeniy Nikolaevdocument.getElementById("css-mnu").innerText.match(/\.menu{([^}]*)/)[1]- Wiktor StribiżewinnerTextbest not to use. - Qwertiy ♦