variable as pattern in regular expression

Comments

2 comments

  • Avatar
    juanjo

    If you are trying to use the contents of those variables as the pattern, you can directly use them:

    <setInstallerVariable>
     <name>installdir</name>
     <value>${installdir}/${project.vendor}-${project.version}/${product_shortname}</value>
     <ruleEvaluationLogic>and</ruleEvaluationLogic>
     <ruleList>
       <regExMatch>
         <logic>does_not_match</logic>
         <pattern>${project.vendor}-${project.version}/${product_shortname}$</pattern>
         <text>${installdir}</text>
       </regExMatch>    
     </ruleList>
    </setinstallervariable>
    

    But if you only need to check if that string is present, you could simply use:

    <compareText text="${installdir}" logic="does_not_contain" value="${project.vendor}-${project.version}/${product_shortname}"/>
    
  • Avatar
    Ronen

    in my case I need to check that these variable are located in the end of the string. I guess I need to user the first option suggested above with the $ sign at the end, correct ?

Please sign in to leave a comment.