Skip to content

Commit

Permalink
[ML] Fix file data visualizer index pattern match (#34721)
Browse files Browse the repository at this point in the history
* [ML] Fix file data visualizer index pattern match

* also global replace . and +
  • Loading branch information
jgowdyelastic authored Apr 8, 2019
1 parent 576283c commit aa78584
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -641,10 +641,10 @@ function isIndexPatternNameValid(name, indexPatternNames, index) {
}

// escape . and + to stop the regex matching more than it should.
let newName = name.replace('.', '\\.');
newName = newName.replace('+', '\\+');
let newName = name.replace(/\./g, '\\.');
newName = newName.replace(/\+/g, '\\+');
// replace * with .* to make the wildcard match work.
newName = newName.replace('*', '.*');
newName = newName.replace(/\*/g, '.*');
const reg = new RegExp(`^${newName}$`);
if (index.match(reg) === null) { // name should match index
return (
Expand Down

0 comments on commit aa78584

Please sign in to comment.