mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 03:10:42 -03:30
Merge pull request #4841 from mabashian/4768-search-keys-parentheses
Fixed regex that was breaking on parenthesis
This commit is contained in:
commit
b2b18dd958
@ -1,7 +1,7 @@
|
||||
export default [function() {
|
||||
return {
|
||||
splitSearchIntoTerms(searchString) {
|
||||
return searchString.match(/(?:[^\s("')]+|"[^"]*"|'[^']*')+/g);
|
||||
return searchString.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);
|
||||
},
|
||||
splitTermIntoParts(searchTerm) {
|
||||
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\" foo')).toEqual(["name:\"foo bar\"", "foo"]);
|
||||
expect(SmartSearchService.splitSearchIntoTerms('inventory:¯\_(ツ)_/¯')).toEqual(["inventory:¯\_(ツ)_/¯"]);
|
||||
expect(SmartSearchService.splitSearchIntoTerms('inventory:¯\_(ツ)_/¯ inventory.name:¯\_(ツ)_/¯')).toEqual(["inventory:¯\_(ツ)_/¯", "inventory.name:¯\_(ツ)_/¯"]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user