This class represents a rule to be used by the
Parser
class.
A parameter, represented by the
ParserRuleParam
class, is a variable part of a rule that can be set by manipulating the parameters object. A rule can have any number of
ParserRuleParam
including none.
Parameters can have a variable number of possible values, this is useful for example if we want to use a rule to extract some infos with a
Parser
from data with a recurring structure (for example a list). In that case one can just define a general rule and then add different values to the parameters in order to get infos for different objects in the list.
For example, consider the following pseudo-HTML list code:
[ul] [li id="id1"]Item1[/li] [li id="id2"]item2[/li] [li id="id3"]item3[/li] ... [li id="idN"]itemN[/li] [/ul]
One could use a rule like this
(?s).*\[li id="(.+?)"\][item][/li].
Then by adding different value to the parameter
item
we can get the
id value of the list members we are looking for.
@author Daniele Rapagnani
@see Parser