Description
I think we are starting to support strings with null characters SERVER-1300. Would be nice if we could match these characters using regular expressions. Not sure if this is supported in pcre though.
> c.drop()
|
true
|
> a = 'a\0b'; |
ab
|
> c.save( {a:a} )
|
> c.find( {a:a} )
|
{ "_id" : ObjectId("4e5c56e5abcf05c6aa443a91"), "a" : "a" } |
> r = new RegExp( 'c|a' ) |
/c|a/
|
> c.find( {a:r} )
|
{ "_id" : ObjectId("4e5c56e5abcf05c6aa443a91"), "a" : "a" } |
> r = new RegExp( 'c\0|a' ) |
/c|a/
|
> c.find( {a:r} )
|
> c.save( {a:r} )
|
> c.find( {a:r} )
|
Mon Aug 29 20:21:01 warning: unknown regex flag:|
|
Mon Aug 29 20:21:01 warning: unknown regex flag:a
|
{ "_id" : ObjectId("4e5c571babcf05c6aa443a92"), "a" : /c/ } |
>
|
|
|
|
|
> r = /a\x00/
|
/a\x00/
|
> a.match(r)
|
[ "a\u0000" ] |
> c.find( {a:r} )
|
>
|
Attachments
Issue Links
- duplicates
-
SERVER-18824 Support matching text that has embedded NUL bytes with $regex
-
- Closed
-
- is duplicated by
-
SERVER-19177 Find using regexp fails when the string is as given
-
- Closed
-