diff --git a/docs/config_coding.html b/docs/config_coding.html index 1dd86748d..7a4ad407e 100644 --- a/docs/config_coding.html +++ b/docs/config_coding.html @@ -502,7 +502,7 @@ public class MySingleton ""(empty) -

Example

+

Examples

To configure the check to forbid String literals containing "a href":

@@ -510,6 +510,18 @@ public class MySingleton <module name="IllegalTokenText"> <property name="tokens" value="STRING_LITERAL"/> <property name="format" value="a href"/> +</module> + + +

+ To configure the check to forbid leading zeros in an integer literal, other than + zero and a hex literal: +

+
+<module name="IllegalTokenText">
+    <property name="tokens" value="NUM_INT,NUM_LONG"/>
+    <property name="format" value="^0[^lx]"/>
+    <property name="ignoreCase" value="true"/>
 </module>
       

Package

diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheck.java index 130c09efa..22ad80756 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheck.java @@ -38,7 +38,7 @@ import com.puppycrawl.tools.checkstyle.checks.GenericIllegalRegexpCheck; * </module> * *

An example of how to configure the check to forbid leading zeros in an - * integer literal, other than a hex value is: + * integer literal, other than zero and a hex literal is: *

  * <module name="IllegalTokenText">
  *     <property name="tokens" value="NUM_INT,NUM_LONG"/>