--- parser3/tests/185.html 2026/11/03 12:29:02 1.8 +++ parser3/tests/185.html 2026/11/03 14:27:02 1.9 @@ -116,6 +116,13 @@ $str[о сколько нам откры ^left[$str](50)
^right[$str](50)
+
+^rem{ *** not valid utf-8: bytes 80-BF without the leading byte are characters of their own, as length counts them *** } +^strays[^#80^#81a^#82й^#83^#84€^#85] +^rem{ *** the last character is cut off by the end of the string: length counts it as a whole *** } +^strays[a€^#E2^#80] +^strays[й^#F0^#9F] + @left[str;num][substr] ^try{ ^if(def $num){ @@ -164,3 +171,15 @@ $str[о сколько нам откры @rpos[str;substr;offset] ^^str.rpos[$substr]^if(def $offset){($offset)}: ^if(def $offset){^str.rpos[$substr]($offset)}{^str.rpos[$substr]}
+ +@strays[str] +$length(^str.length[]) +
^taint[uri][$str] [$length]
+^for[i](0;$length+2){^stray[$str]($i)} + +@stray[str;n] +$first[^str.left($n)] +$last[^str.right($n)] +^rem{ *** right(n) is mid(length-n): counting from the start, as it was before right went from the end *** } +$by_mid[^str.mid(^math:max(0;$length-$n))] +${n}: '^taint[uri][$first]' [^first.length[]] '^taint[uri][$last]' [^last.length[]] ^if($last eq $by_mid){same as mid}