diff --git a/RegExpSupport/resources/inspectionDescriptions/RegExpAnonymousGroup.html b/RegExpSupport/resources/inspectionDescriptions/RegExpAnonymousGroup.html index e7878f58769f..9cebfbbd8b25 100644 --- a/RegExpSupport/resources/inspectionDescriptions/RegExpAnonymousGroup.html +++ b/RegExpSupport/resources/inspectionDescriptions/RegExpAnonymousGroup.html @@ -1,14 +1,18 @@ - - Reports anonymous capturing groups and numeric back references in a RegExp. These are only reported when the RegExp dialect supports named group and named group references. Named groups and named back references improve code readability and are recommended to use instead. When a capture is not needed, matching can be more performant and use less memory by using a non-capturing group, -i.e. (?:xxx) instead of (xxx). +i.e. (?:xxx) instead of (xxx). +

Example:

+

+  (\d\d\d\d)\1
+
+

A better regex pattern could look like this:

+

+  (?<quad>\d\d\d\d)\k<quad>
+

New in 2017.2 diff --git a/RegExpSupport/resources/inspectionDescriptions/RegExpDuplicateAlternationBranch.html b/RegExpSupport/resources/inspectionDescriptions/RegExpDuplicateAlternationBranch.html index e1b0171a53b2..591798cd6bd4 100644 --- a/RegExpSupport/resources/inspectionDescriptions/RegExpDuplicateAlternationBranch.html +++ b/RegExpSupport/resources/inspectionDescriptions/RegExpDuplicateAlternationBranch.html @@ -1,11 +1,15 @@ - - -Reports duplicate branches in a RegExp alternation. For example (a|b|a). +Reports duplicate branches in a RegExp alternation. Duplicate branches slow down matching and obscure the intent of the expression. +

Example:

+

+  (alpha|bravo|charlie|alpha)
+
+

After the quick-fix is applied:

+

+  (alpha|bravo|charlie)
+

New in 2017.1 diff --git a/RegExpSupport/resources/inspectionDescriptions/RegExpDuplicateCharacterInClass.html b/RegExpSupport/resources/inspectionDescriptions/RegExpDuplicateCharacterInClass.html index 20a87740f6a7..9598762ac948 100644 --- a/RegExpSupport/resources/inspectionDescriptions/RegExpDuplicateCharacterInClass.html +++ b/RegExpSupport/resources/inspectionDescriptions/RegExpDuplicateCharacterInClass.html @@ -1,7 +1,15 @@ -Reports duplicate characters inside a RegExp character class. For example [++]. +Reports duplicate characters inside a RegExp character class. Duplicate characters are unnecessary and can be removed without changing the semantics of the regex. +

Example:

+

+  [aabc]
+
+

After the quick-fix is applied:

+

+  [abc]
+
\ No newline at end of file diff --git a/RegExpSupport/resources/inspectionDescriptions/RegExpEmptyAlternationBranch.html b/RegExpSupport/resources/inspectionDescriptions/RegExpEmptyAlternationBranch.html index 1040ea6b055d..44b6a1c629bb 100644 --- a/RegExpSupport/resources/inspectionDescriptions/RegExpEmptyAlternationBranch.html +++ b/RegExpSupport/resources/inspectionDescriptions/RegExpEmptyAlternationBranch.html @@ -1,12 +1,16 @@ - - -Reports empty branches in a RegExp alternation. For example:
a||b -

An empty branch will only match the empty string, and in most cases that is not what is desired. +Reports empty branches in a RegExp alternation. +An empty branch will only match the empty string, and in most cases that is not what is desired. This inspection will not report a single empty branch at the start or the end of an alternation. +

Example:

+

+  (alpha||bravo)
+
+

After the quick-fix is applied:

+

+  (alpha|bravo)
+

New in 2017.2 diff --git a/RegExpSupport/resources/inspectionDescriptions/RegExpEscapedMetaCharacter.html b/RegExpSupport/resources/inspectionDescriptions/RegExpEscapedMetaCharacter.html index e037d83b085e..5d1a5ded6105 100644 --- a/RegExpSupport/resources/inspectionDescriptions/RegExpEscapedMetaCharacter.html +++ b/RegExpSupport/resources/inspectionDescriptions/RegExpEscapedMetaCharacter.html @@ -1,15 +1,18 @@ - - -Reports the escaped meta characters, e.g. \.. +Reports the escaped meta characters. Some RegExp coding styles specify that meta characters should be placed inside a character class, to make the regular expression easier to understand. -For example the regex \d+\.\d+ would be written as \d+[.]\d+. -This inspection does not warn about the meta character [, ] and ^, +This inspection does not warn about the meta character [, ] and ^, because those would need additional escaping inside a character class. +

Example:

+

+  \d+\.\d+
+
+

After the quick-fix is applied:

+

+  \d+[.]\d+
+

New in 2017.1 diff --git a/RegExpSupport/resources/inspectionDescriptions/RegExpOctalEscape.html b/RegExpSupport/resources/inspectionDescriptions/RegExpOctalEscape.html index f4b72837406f..f6313b60d9cd 100644 --- a/RegExpSupport/resources/inspectionDescriptions/RegExpOctalEscape.html +++ b/RegExpSupport/resources/inspectionDescriptions/RegExpOctalEscape.html @@ -1,11 +1,15 @@ - - Reports octal escapes, which are easily confused with back references. Use hexadecimal escapes to avoid confusion. +

Example:

+

+  \07
+
+

After the quick-fix is applied:

+

+  \x07
+

New in 2017.1 diff --git a/RegExpSupport/resources/inspectionDescriptions/RegExpRedundantEscape.html b/RegExpSupport/resources/inspectionDescriptions/RegExpRedundantEscape.html index fd3c56cdba77..4087d9ce428f 100644 --- a/RegExpSupport/resources/inspectionDescriptions/RegExpRedundantEscape.html +++ b/RegExpSupport/resources/inspectionDescriptions/RegExpRedundantEscape.html @@ -1,12 +1,15 @@ - - Reports character escapes that are replaceable with the unescaped character without a change in meaning. Note that inside the square brackets of a character class, many escapes are unnecessary that would be necessary outside of a character class. -For example the regex [\.] is identical to [.] +

Example:

+

+  \-\;[\.]
+
+

After the quick-fix is applied:

+

+  -;[.]
+

New in 2017.3 diff --git a/RegExpSupport/resources/inspectionDescriptions/RegExpRedundantNestedCharacterClass.html b/RegExpSupport/resources/inspectionDescriptions/RegExpRedundantNestedCharacterClass.html index 151c53d3c666..a3c4514c328a 100644 --- a/RegExpSupport/resources/inspectionDescriptions/RegExpRedundantNestedCharacterClass.html +++ b/RegExpSupport/resources/inspectionDescriptions/RegExpRedundantNestedCharacterClass.html @@ -1,7 +1,14 @@ Reports unnecessary nested character classes. -For example [a-c[x-z]], which is equivalent too [a-cx-z]. +

Example:

+

+  [a-c[x-z]]
+
+

After the quick-fix is applied:

+

+  [a-cx-z]
+

New in 2020.2 diff --git a/RegExpSupport/resources/inspectionDescriptions/RegExpRepeatedSpace.html b/RegExpSupport/resources/inspectionDescriptions/RegExpRepeatedSpace.html index 4da65f9679ce..361f43fb6bd6 100644 --- a/RegExpSupport/resources/inspectionDescriptions/RegExpRepeatedSpace.html +++ b/RegExpSupport/resources/inspectionDescriptions/RegExpRepeatedSpace.html @@ -1,12 +1,16 @@ - - Reports multiple consecutive spaces in a RegExp. Because spaces are not visible by default, it can be hard to see how many spaces are required. The RegExp can be made more clear by replacing the consecutive spaces with a single space and a counted quantifier. +

Example:

+

+  (     )
+
+

After the quick-fix is applied:

+

+  ( {5})
+

New in 2017.1 diff --git a/RegExpSupport/resources/inspectionDescriptions/RegExpSingleCharAlternation.html b/RegExpSupport/resources/inspectionDescriptions/RegExpSingleCharAlternation.html index 4e191800828e..c9f9e3064340 100644 --- a/RegExpSupport/resources/inspectionDescriptions/RegExpSingleCharAlternation.html +++ b/RegExpSupport/resources/inspectionDescriptions/RegExpSingleCharAlternation.html @@ -1,8 +1,16 @@ -Reports single char alternation (e.g. a|b|c|d) in a RegExp. -It is simpler to use a character class ([abcd]) instead. -This usually also provides slightly better matching performance. +Reports single char alternation in a RegExp. +It is simpler to use a character class instead. +This may also provide better matching performance. +

Example:

+

+  a|b|c|d
+
+

After the quick-fix is applied:

+

+  [abcd]
+

New in 2017.1 diff --git a/RegExpSupport/resources/inspectionDescriptions/RegExpUnexpectedAnchor.html b/RegExpSupport/resources/inspectionDescriptions/RegExpUnexpectedAnchor.html index 53f48ea59300..472e1e1a9ccb 100644 --- a/RegExpSupport/resources/inspectionDescriptions/RegExpUnexpectedAnchor.html +++ b/RegExpSupport/resources/inspectionDescriptions/RegExpUnexpectedAnchor.html @@ -1,13 +1,13 @@ - - Reports ^ or \A anchors not at the beginning of the pattern and $, \Z or \z anchors not at the end of the pattern. In the wrong position these RegExp anchors prevent the pattern from matching anything. In case of the ^ and $ anchors, most likely the literal character was meant and the escape forgotten. +

Example:

+

+  (Price $10)
+

New in 2018.1 diff --git a/RegExpSupport/resources/inspectionDescriptions/RegExpUnnecessaryNonCapturingGroup.html b/RegExpSupport/resources/inspectionDescriptions/RegExpUnnecessaryNonCapturingGroup.html index 627aaa4cc82c..c483b39aa330 100644 --- a/RegExpSupport/resources/inspectionDescriptions/RegExpUnnecessaryNonCapturingGroup.html +++ b/RegExpSupport/resources/inspectionDescriptions/RegExpUnnecessaryNonCapturingGroup.html @@ -1,10 +1,14 @@ -Reports unnecessary non-capturing groups. -For example
-Everybody be cool, (?:this) is a robbery!
-is equivalent too
-Everybody be cool, this is a robbery!. +Reports unnecessary non-capturing groups, which have no influence on the match result. +

Example:

+

+  Everybody be cool, (?:this) is a robbery!
+
+

After the quick-fix is applied:

+

+  Everybody be cool, this is a robbery!
+

New in 2021.1