mirror of
https://github.com/ansible/awx.git
synced 2026-03-04 02:01:01 -03:30
Merge pull request #4841 from mabashian/4768-search-keys-parentheses
Fixed regex that was breaking on parenthesis
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
export default [function() {
|
export default [function() {
|
||||||
return {
|
return {
|
||||||
splitSearchIntoTerms(searchString) {
|
splitSearchIntoTerms(searchString) {
|
||||||
return searchString.match(/(?:[^\s("')]+|"[^"]*"|'[^']*')+/g);
|
return searchString.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);
|
||||||
},
|
},
|
||||||
splitTermIntoParts(searchTerm) {
|
splitTermIntoParts(searchTerm) {
|
||||||
let breakOnColon = searchTerm.match(/(?:[^:"]+|"[^"]*")+/g);
|
let breakOnColon = searchTerm.match(/(?:[^:"]+|"[^"]*")+/g);
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ describe('Service: SmartSearch', () => {
|
|||||||
expect(SmartSearchService.splitSearchIntoTerms('name:\'foo bar\' description:\'bar foo\'')).toEqual(["name:\'foo bar\'", "description:\'bar foo\'"]);
|
expect(SmartSearchService.splitSearchIntoTerms('name:\'foo bar\' description:\'bar foo\'')).toEqual(["name:\'foo bar\'", "description:\'bar foo\'"]);
|
||||||
expect(SmartSearchService.splitSearchIntoTerms('name:\"foo bar\" description:\'bar foo\'')).toEqual(["name:\"foo bar\"", "description:\'bar foo\'"]);
|
expect(SmartSearchService.splitSearchIntoTerms('name:\"foo bar\" description:\'bar foo\'')).toEqual(["name:\"foo bar\"", "description:\'bar foo\'"]);
|
||||||
expect(SmartSearchService.splitSearchIntoTerms('name:\"foo bar\" foo')).toEqual(["name:\"foo bar\"", "foo"]);
|
expect(SmartSearchService.splitSearchIntoTerms('name:\"foo bar\" foo')).toEqual(["name:\"foo bar\"", "foo"]);
|
||||||
|
expect(SmartSearchService.splitSearchIntoTerms('inventory:¯\_(ツ)_/¯')).toEqual(["inventory:¯\_(ツ)_/¯"]);
|
||||||
|
expect(SmartSearchService.splitSearchIntoTerms('inventory:¯\_(ツ)_/¯ inventory.name:¯\_(ツ)_/¯')).toEqual(["inventory:¯\_(ツ)_/¯", "inventory.name:¯\_(ツ)_/¯"]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user