mirror of
				https://github.com/qgis/QGIS.git
				synced 2025-11-04 00:04:25 -05:00 
			
		
		
		
	The Expression LIKE binary operator does not care about escape % and _ char. No-one has already open an issue about it but in the OGC element PropertyIsLike the user can defined is own wild and single char. This mean that QGIS has to escape % and _ if they are not used as wild and single char.
		
			
				
	
	
		
			22 lines
		
	
	
		
			930 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			930 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
{
 | 
						|
  "name": "LIKE",
 | 
						|
  "type": "operator",
 | 
						|
  "description": "Returns 1 if the first parameter matches the supplied pattern. Works with numbers also.",
 | 
						|
  "arguments": [
 | 
						|
    {"arg":"string/number","description":"value"},
 | 
						|
    {"arg":"pattern","description":"pattern to compare value with, you can use '%' as a wildcard, '_' as a single char and '\\\\' to escape."}
 | 
						|
  ],
 | 
						|
  "examples": [
 | 
						|
    { "expression":"'A' LIKE 'A'", "returns":"1"},
 | 
						|
    { "expression":"'A' LIKE 'a'", "returns":"0"},
 | 
						|
    { "expression":"'A' LIKE 'B'", "returns":"0"},
 | 
						|
    { "expression":"'ABC' LIKE 'B'", "returns":"0"},
 | 
						|
    { "expression":"'ABC' LIKE '_B_'", "returns":"1"},
 | 
						|
    { "expression":"'ABCD' LIKE '_B_'", "returns":"0"},
 | 
						|
    { "expression":"'ABCD' LIKE '_B%'", "returns":"1"},
 | 
						|
    { "expression":"'ABCD' LIKE '%B%'", "returns":"1"},
 | 
						|
    { "expression":"'1%' LIKE '1\\\\%'", "returns":"1"},
 | 
						|
    { "expression":"'1_' LIKE '1\\\\%'", "returns":"0"}
 | 
						|
  ]
 | 
						|
}
 |