[ML] Fix file data visualizer index pattern match (#34721)

* [ML] Fix file data visualizer index pattern match

* also global replace . and +
This commit is contained in:
James Gowdy 2019-04-08 16:57:06 +01:00 committed by GitHub
parent 576283cca9
commit aa78584adc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 (