.
D 2001-08-04T04:28:19
J icomment Logged\sIn:\sYES\s\nuser_id=286083\n\n>The\sregular\sexpression\s\n>{<script(.(?!</script>))*?\n>(doubleclick|flycast|burstnet|spylog)+?.*?</script>}\n>is\sinvalid:\sit\scontains\sa\sconstraint\s(the\slookahead)\n>followed\sby\sa\squantifier,\swhich\sis\sexpressly\sforbidden\sin\n>the\sman\spage\sfor\sre_syntax.\n\nYou\saren't\sright.\sIf\syou\sfollow\slookahead\sconstraint\s\ndirectly\s(NB!)\swith\squantifier,\sinterpreter\sreports\san\s\nerror.\sAnd\smy\sconstruction\sworks\sfine\s(interpreter\sdoesn't\s\nreport\sany\serror),\sbecause\slookahead\satom\sdoesn't\sfollow\s\nany\squantifier.\sBut\sworks\squickly\sonly\son\ssmall\sbuffer.\nAlso,\sif\syou\swait\sa\slong-long\stime\s(you\scan\sdecrease\stext\s\nsize\sbetween\s<script>\sand\s</script>\sin\sexample),\s\ninterpreter\sun-hungs,\sand\sreturn\scorrect\sresult.\n\n\n>I\sthink\sthe\sauthor\sactually\swanted\ssomething\slike\n>{<script(?=.*</script>).*?\n>(doubleclick|flycast|burstnet|spylog).*?</script>}\n>which\sruns\sOK\s(albeit\sslowly;\sthere\sis\sprobably\sa\s\n>better\sway\sto\sexpress\sthis).\n\nYou\saren't\sright\sagain.\s:)\nTry:\n#\smy\sexpression\nset\smy\s{<script(.(?!</script>))*?(123)+?.*?</script>}\n#\syour\sexpression\nset\smo\s{<script(?=.*</script>).*?(123).*?</script>}\n#\ssample\stext\nset\stext\s{<script>\s123\s</script>\s<script>\s345\s</script>\s\n<script>\s123\s</script>}\n\n#\sCorrect\sresult\nregsub\s-all\s$my\s$text\s---\sres\n2\nset\sres\n---\s<script>\s345\s</script>\s---\n\n#\sNot\scorrect\sresult:\s\nregsub\s-all\s$mo\s$text\s---\sres\n2\nset\sres\n---\s---\n\nBtw,\sif\syou\sknow,\show\sto\sget\sfirst\sresult\swithout\susing\sof\s\nconstraint\slookahead\swith\snon-greedy\squantifier,\slet\sme\s\nknow.\s:)\n\n>OTOH,\sthe\sregexp\sengine\sshould\scomplain\sabout\sthe\s\n>bad\ssyntax\n>and\sreturn\san\serror,\sinstead\sof\sgetting\sinto\san\sinfinite\n>loop.\s\n\nIMHO,\sitsn't\sinfinite\sloop,\sbut\sonly\svery\sslow\swork\swith\s\nlookahead\sconstraints.\n\n
J login kofeinik
J mimetype text/plain
J username kofeinik
K 446565ffffffffffffffffffffffffffffffffff
U kofeinik
Z 18b820b765fc24202a7060d7c319abb9