add RegEx tester
This commit is contained in:
		
							parent
							
								
									88f364137c
								
							
						
					
					
						commit
						0d36039ba5
					
				
					 1 changed files with 26 additions and 0 deletions
				
			
		
							
								
								
									
										26
									
								
								src/scripts/utils/RegExManager.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								src/scripts/utils/RegExManager.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,26 @@ | ||||||
|  | /* | ||||||
|  | RegEx Manager | ||||||
|  | Tests and manages regular expressions | ||||||
|  | */ | ||||||
|  | 
 | ||||||
|  | class RegExManager { | ||||||
|  | 	/* | ||||||
|  | 	Tests a regular expression. | ||||||
|  | 
 | ||||||
|  | 	@param {string} expression The regular expression to test. | ||||||
|  | 	@return {boolean} the state | ||||||
|  | 	*/ | ||||||
|  | 	static test(expression) { | ||||||
|  | 		let RESULT = {}; | ||||||
|  | 		RESULT[`state`] = false; | ||||||
|  | 		try { | ||||||
|  | 			console.log(expression); | ||||||
|  | 			RESULT[`expression`] = new RegExp(expression); | ||||||
|  | 			RESULT[`state`] = true; | ||||||
|  | 		} catch(err) {}; | ||||||
|  | 
 | ||||||
|  | 		return (RESULT[`state`]); | ||||||
|  | 	}; | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | export {RegExManager}; | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue