SQLite
Check-in [82957495aa]
Not logged in
Overview
SHA1 Hash:82957495aa0729468a020c2a0a45ed60019b6e07
Date: 2013-01-18 03:35:14
User: drh
Comment:The \xXX escape in the test_regexp.c must be followed by exactly two hex digits.
Tags And Properties
Changes
hide diffs unified diffs patch

Changes to src/test_regexp.c

22 ** X|Y X or Y 22 ** X|Y X or Y 23 ** ^X X occurring at the beginning of the string 23 ** ^X X occurring at the beginning of the string 24 ** X$ X occurring at the end of the string 24 ** X$ X occurring at the end of the string 25 ** . Match any single character 25 ** . Match any single character 26 ** \c Character c where c is one of \{}()[]|*+?. 26 ** \c Character c where c is one of \{}()[]|*+?. 27 ** \c C-language escapes for c in afnrtv. ex: \t or \n 27 ** \c C-language escapes for c in afnrtv. ex: \t or \n 28 ** \uXXXX Where XXXX is exactly 4 hex digits, unicode value XXXX 28 ** \uXXXX Where XXXX is exactly 4 hex digits, unicode value XXXX 29 ** \xXXX Where XXX is any number of hex digits, unicode value XXX | 29 ** \xXX Where XX is exactly 2 hex digits, unicode value XX 30 ** [abc] Any single character from the set abc 30 ** [abc] Any single character from the set abc 31 ** [^abc] Any single character not in the set abc 31 ** [^abc] Any single character not in the set abc 32 ** [a-z] Any single character in the range a-z 32 ** [a-z] Any single character in the range a-z 33 ** [^a-z] Any single character not in the range a-z 33 ** [^a-z] Any single character not in the range a-z 34 ** \b Word boundary 34 ** \b Word boundary 35 ** \w Word character. [A-Za-z0-9_] 35 ** \w Word character. [A-Za-z0-9_] 36 ** \W Non-word character 36 ** \W Non-word character ................................................................................................................................................................................ 383 static unsigned re_esc_char(ReCompiled *p){ 383 static unsigned re_esc_char(ReCompiled *p){ 384 static const char zEsc[] = "afnrtv\\()*.+?[$^{|}]"; 384 static const char zEsc[] = "afnrtv\\()*.+?[$^{|}]"; 385 static const char zTrans[] = "\a\f\n\r\t\v"; 385 static const char zTrans[] = "\a\f\n\r\t\v"; 386 int i, v = 0; 386 int i, v = 0; 387 char c; 387 char c; 388 if( p->sIn.i>=p->sIn.mx ) return 0; 388 if( p->sIn.i>=p->sIn.mx ) return 0; 389 c = p->sIn.z[p->sIn.i]; 389 c = p->sIn.z[p->sIn.i]; 390 if( c=='u' && p->sIn.i+5<p->sIn.mx ){ | 390 if( c=='u' && p->sIn.i+4<p->sIn.mx ){ 391 const unsigned char *zIn = p->sIn.z + p->sIn.i; 391 const unsigned char *zIn = p->sIn.z + p->sIn.i; 392 v = 0; < 393 if( re_hex(zIn[1],&v) 392 if( re_hex(zIn[1],&v) 394 && re_hex(zIn[2],&v) 393 && re_hex(zIn[2],&v) 395 && re_hex(zIn[3],&v) 394 && re_hex(zIn[3],&v) 396 && re_hex(zIn[4],&v) 395 && re_hex(zIn[4],&v) 397 ){ 396 ){ 398 p->sIn.i += 5; 397 p->sIn.i += 5; 399 return v; 398 return v; 400 } 399 } 401 } 400 } 402 if( c=='x' ){ | 401 if( c=='x' && p->sIn.i+2<p->sIn.mx ){ 403 v = 0; | 402 const unsigned char *zIn = p->sIn.z + p->sIn.i; 404 for(i=1; p->sIn.i<p->sIn.mx && re_hex(p->sIn.z[p->sIn.i+i], &v); i++){} | 403 if( re_hex(zIn[1],&v) 405 if( i>1 ){ | 404 && re_hex(zIn[2],&v) > 405 ){ 406 p->sIn.i += i; | 406 p->sIn.i += 3; 407 return v; 407 return v; 408 } 408 } 409 } 409 } 410 for(i=0; zEsc[i] && zEsc[i]!=c; i++){} 410 for(i=0; zEsc[i] && zEsc[i]!=c; i++){} 411 if( zEsc[i] ){ 411 if( zEsc[i] ){ 412 if( i<6 ) c = zTrans[i]; 412 if( i<6 ) c = zTrans[i]; 413 p->sIn.i++; 413 p->sIn.i++;

Changes to test/regexp1.test

193 'abc{4}x' REGEXP '^abc\{4\}x$', 193 'abc{4}x' REGEXP '^abc\{4\}x$', 194 'abc|def' REGEXP '^abc\|def$' 194 'abc|def' REGEXP '^abc\|def$' 195 } {1 1 1 1 1 1 1 1 1 1 1 1} 195 } {1 1 1 1 1 1 1 1 1 1 1 1} 196 196 197 do_execsql_test regexp1-2.20 { 197 do_execsql_test regexp1-2.20 { 198 SELECT 'abc$¢€xyz' REGEXP '^abc\u0024\u00a2\u20acxyz$', 198 SELECT 'abc$¢€xyz' REGEXP '^abc\u0024\u00a2\u20acxyz$', 199 'abc$¢€xyz' REGEXP '^abc\u0024\u00A2\u20ACxyz$', 199 'abc$¢€xyz' REGEXP '^abc\u0024\u00A2\u20ACxyz$', 200 'abc$¢€xyz' REGEXP '^abc\x24\xa2\x20acxyz$' | 200 'abc$¢€xyz' REGEXP '^abc\x24\xa2\u20acxyz$' 201 } {1 1 1} 201 } {1 1 1} 202 do_execsql_test regexp1-2.21 { 202 do_execsql_test regexp1-2.21 { 203 SELECT 'abc$¢€xyz' REGEXP '^abc[\u0024][\u00a2][\u20ac]xyz$', 203 SELECT 'abc$¢€xyz' REGEXP '^abc[\u0024][\u00a2][\u20ac]xyz$', 204 'abc$¢€xyz' REGEXP '^abc[\u0024\u00A2\u20AC]{3}xyz$', 204 'abc$¢€xyz' REGEXP '^abc[\u0024\u00A2\u20AC]{3}xyz$', 205 'abc$¢€xyz' REGEXP '^abc[\x24][\xa2\x20ac]+xyz$' | 205 'abc$¢€xyz' REGEXP '^abc[\x24][\xa2\u20ac]+xyz$' 206 } {1 1 1} 206 } {1 1 1} 207 do_execsql_test regexp1-2.22 { 207 do_execsql_test regexp1-2.22 { 208 SELECT 'abc$¢€xyz' REGEXP '^abc[^\u0025-X][^ -\u007f][^\u20ab]xyz$' 208 SELECT 'abc$¢€xyz' REGEXP '^abc[^\u0025-X][^ -\u007f][^\u20ab]xyz$' 209 } {1} 209 } {1} 210 210 211 finish_test 211 finish_test