You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					17 lines
				
				677 B
			
		
		
			
		
	
	
					17 lines
				
				677 B
			| 
											3 years ago
										 | 'use strict' | ||
|  | 
 | ||
|  | module.exports = /[^.[\]]+|\[((?:.)*?)\]/g | ||
|  | 
 | ||
|  | /* | ||
|  | Regular expression explanation: | ||
|  | 
 | ||
|  | Alt 1: /[^.[\]]+/ - Match one or more characters that are *not* a dot (.) | ||
|  |                     opening square bracket ([) or closing square bracket (]) | ||
|  | 
 | ||
|  | Alt 2: /\[((?:.)*?)\]/ - If the char IS dot or square bracket, then create a capture | ||
|  |                          group (which will be capture group $1) that matches anything | ||
|  |                          within square brackets. Expansion is lazy so it will | ||
|  |                          stop matching as soon as the first closing bracket is met `]` | ||
|  |                          (rather than continuing to match until the final closing bracket). | ||
|  | */ |