mirror of
				https://github.com/AppFlowy-IO/AppFlowy.git
				synced 2025-10-31 01:54:37 +00:00 
			
		
		
		
	 f5cb8b6d25
			
		
	
	
		f5cb8b6d25
		
			
		
	
	
	
	
		
			
			* fix: image url check in for embed link * chore: move all patterns to shared * test: prefer enterText over manipulating widget
		
			
				
	
	
		
			24 lines
		
	
	
		
			934 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			934 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
| const _trailingZerosPattern = r'^(\d+(?:\.\d*?[1-9](?=0|\b))?)\.?0*$';
 | |
| final trailingZerosRegex = RegExp(_trailingZerosPattern);
 | |
| 
 | |
| const _hrefPattern =
 | |
|     r'https?://(?:www\.)?[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,}(?:/[^\s]*)?';
 | |
| final hrefRegex = RegExp(_hrefPattern);
 | |
| 
 | |
| /// This pattern allows for both HTTP and HTTPS Scheme
 | |
| /// It allows for query parameters
 | |
| /// It only allows the following image extensions: .png, .jpg, .gif, .webm
 | |
| ///
 | |
| const _imgUrlPattern =
 | |
|     r'(https?:\/\/)([^\s(["<,>/]*)(\/)[^\s[",><]*(.png|.jpg|.gif|.webm)(\?[^\s[",><]*)?';
 | |
| final imgUrlRegex = RegExp(_imgUrlPattern);
 | |
| 
 | |
| const _appflowyCloudUrlPattern = r'^(https:\/\/)(.*)(\.appflowy\.cloud\/)(.*)';
 | |
| final appflowyCloudUrlRegex = RegExp(_appflowyCloudUrlPattern);
 | |
| 
 | |
| const _camelCasePattern = '(?<=[a-z])[A-Z]';
 | |
| final camelCaseRegex = RegExp(_camelCasePattern);
 | |
| 
 | |
| const _macOSVolumesPattern = '^/Volumes/[^/]+';
 | |
| final macOSVolumesRegex = RegExp(_macOSVolumesPattern);
 |