Post Reply 
Character '>' in Attribute Values
Nov. 27, 2012, 10:10 AM (This post was last modified: Nov. 27, 2012 12:10 PM by neverwasinparis.)
Post: #1
Character '>' in Attribute Values
in many config sets, also in Sidkis, '[^>]++' is used in pattern filters to find the end of an opening tag. but what about a '>' in an attribute value?
for example:

<div onclick="A>1 && B()">

'[^>]++' stops after '<div onclick="A' and does not get what we want and could create invalid code.

so why is '[^>]++' used? did really nobody ever thought about that case? or is it not worth to mind it because it's rarely used?

with that (just an example):

<div(\s( \w=$AV(*)| \w)\#++|)>

we get what we want. it works no matter how many '>' there are in attribute values. but it makes the code harder to read and slower. that's for sure. but i think it's worth it to get no errors. what do you think?
Add Thank You Quote this message in a reply
Nov. 28, 2012, 02:14 AM
Post: #2
RE: Character '>' in Attribute Values
(Nov. 27, 2012 10:10 AM)neverwasinparis Wrote:  so why is '[^>]++' used?

[^>]++ is used to make the matching expression fail (and maybe match) quicker.

Consider: <div >stuff<div onclick="A

where you want to find: <div onclick="A

An expression like <div[^>]++onclick="a will fail quickly at <div >.

<div*onclick="a will find the first <div and search past the first >. This wastes time and may reqire additional code to negate an unwanted match.

Of course, the rest of the expression must match what [^>]++ does not. sidki is very good at this. Wink
Add Thank You Quote this message in a reply
Post Reply 

Forum Jump: