SebbASF created MENFORCER-139:
---------------------------------

             Summary: Regex rule example is incorrect; matching is not described
                 Key: MENFORCER-139
                 URL: https://jira.codehaus.org/browse/MENFORCER-139
             Project: Maven 2.x Enforcer Plugin
          Issue Type: Bug
          Components: Standard Rules
         Environment: 
http://maven.apache.org/enforcer/enforcer-rules/requireProperty.html
            Reporter: SebbASF


The documentation page [1] has an example rule containing:

{noformat}
<regex>\d</regex>
<regexMessage>You must have a digit in your baseDir!</regexMessage>
{noformat}

This is very misleading, as \d only matches a single digit.
The example should be:

{noformat}
<regex>.*\d.*</regex>
<regexMessage>You must have a digit in your baseDir!</regexMessage>
{noformat}

or possibly:

{noformat}
<regex>\d</regex>
<regexMessage>Your baseDir must consist of a single digit only!</regexMessage>
{noformat}

The documentation should state that the regex is applied to the entire value of 
the property. 
That is, it uses regex "match" rather than regex "contains", effectively the 
regex string is enclosed in "^" and "$" before use.

[1] http://maven.apache.org/enforcer/enforcer-rules/requireProperty.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to