Validate <param> Using Javascript Parser
How can I validate
<param name="controller" value="true"></param>
AND
<param name="controller" value="true" />
Using same Javascript Parser string. Currently I'm using /(<param[\s|\S]*?>)[\s|\S]*\/>/i;
which only validates second pa开发者_StackOverflow社区ttern.
Thanks in advance!
/<param.*?(?:\/>|><\/param>)/i
matches both of them. See example on Rubular.
You may try this
<param[^>.]+(/>[^<]|[^/]></param>)
Now it will match only the first two of the four below
<param name="controller" value="true"></param>
AND
<param name="controller" value="true" />
AND
<param name="controller" value="true"/></param>
AND
<param name="controller" value="true">
精彩评论