regex - Check that property matches pattern -
using nant, i'd check property matches following pattern: [0-9a-za-z_]
.
i have tried far:
<condition property="check-my-prop"> <matches pattern="[1-9a-za-z_]" string="${myprop}"/> </condition> <fail message="my-prop must match pattern [1-9a-za-z_]" unless="check-my-prop" />
nant throws error: invalid element <condition>. unknown task or datatype.
code adapted ant, not nant.
how can achieve same goal?
<property name="checkmyprop" value="" /> <regex pattern="^(?'checkmyprop'[1-9a-za-z_]+)$" input="${myprop}" failonerror="false"/> <if test="${string::get-length(checkmyprop) == 0}"> <fail>myprop must match pattern [1-9a-za-z_]</fail> </if>
Comments
Post a Comment