diff --git a/rules/prefer-starts-ends-with.js b/rules/prefer-starts-ends-with.js index 209ba42a5e..4105c3e113 100644 --- a/rules/prefer-starts-ends-with.js +++ b/rules/prefer-starts-ends-with.js @@ -11,7 +11,7 @@ const doesNotContain = (string, characters) => characters.every(character => !st const isSimpleString = string => doesNotContain( string, - ['^', '$', '+', '[', '{', '(', '\\', '.', '?', '*'] + ['^', '$', '+', '[', '{', '(', '\\', '.', '?', '*', '|'] ); const regexTestSelector = [ diff --git a/test/prefer-starts-ends-with.js b/test/prefer-starts-ends-with.js index 5b28a1c7c3..2a00e4c00e 100644 --- a/test/prefer-starts-ends-with.js +++ b/test/prefer-starts-ends-with.js @@ -26,7 +26,9 @@ const validRegex = [ /\^foo/, /^foo/i, /^foo/m, - /^foo/im + /^foo/im, + /^A|B/, + /A|B$/ ]; const invalidRegex = [