¤Sµo²{¤F¤@Ó .net ªºbug!³Ìªñ¦b¨Ï¥Î¥¿«h¹Bºâ¦¡ªº®ÉÔµo²{¡G¦b©¿²¤¤j¤p¼gªº®ÉÔ¡A¤Ç°tȱq 0xff ¨ì 0xffff ¤§¶¡ªº©Ò¦³¦r²Å¡A¥¿«h¹Bºâ¦¡³ºµM¤]¯à¤Ç°t¨âÓ ASCII ¦r²Å¡Gi(code: 0x69) ©M I(code: 0x49);¦ý¬O¤´µM¤£¯à¤Ç°t¨ä¥Lªº ASCII ¦r¥À©M¼Æ¦r¡C
¤ñ¦p¥H¤Uªº¥N½X´N¬O¥Î¨Ó´ú¸Õ¥Î¥¿«h¹Bºâ¦¡¤Ç°t±q 0xff ¨ì 0xffff ªº¦r²Å¡C¦ÓȽd³ò¦b 0 ¨ì 0xfe ªº©Ò¦³¦r²Å¬O¤£¯à³Q¤Ç°tªº¡C
¡@¡@1234567891011121314151617Regex regex = new Regex(@"[/u00FF-/uFFFF]+");
¡@¡@// The characters, whoes value are smaller than 0xff, are not expected to be matched.
¡@¡@for (int i = 0; i < 0xff; i++) {
¡@¡@string s = new string(new char[] { (char)i });
¡@¡@Debug.Assert(
¡@¡@!regex.IsMatch(s),
¡@¡@string.Format("The character was not expected to be matched: 0x{0:X}!", i));
¡@¡@}
¡@¡@// However, the characters whoes value are greater than 0xfe are expected to be matched.
¡@¡@for (int i = 0xff; i <= 0xffff; i++) {
¡@¡@string s = new string(new char[] { (char)i });
¡@¡@Debug.Assert(
¡@¡@regex.IsMatch(s),
¡@¡@string.Format("The character was expected to be matched: 0x{0:X}!", i));
¡@¡@}
|
³o®Éªº¹B¦æµ²ªG¬O¥¿±`ªº¡A¨S¦³¥ô¦óªºÂ_¨¥¿ù»~¥X²{¡C
µM¦Ó·í¨Ï¥Î©¿²¤¤j¤p¼gªº¤Ç°t¼Ò¦¡®É¡Aµ²ªG´N¤£¤@¼Ë¤F¡C±N¤W±¥N½X¤¤ªº²Ä¤@¦æ§ï¦¨¡G
1Regex regex = new Regex(@"[/u00FF-/uFFFF]+", RegexOptions.IgnoreCase);
µ{¦¡¹B¦æªº®ÉÔ´N·|¦³¨â³BÂ_¨¥¿ù»~¡C¥¦Ì¤À§O¬O¦r²ÅȬ° 73 ©M 105¡A¤]´N¬O¤p¼g¦r¥À i ©M¤j¼g¦r¥À I¡C ³oÓ bug «D±`©_©Ç¡A§Oªº¦r²Å³£«Ü¥¿±`!¦Ó¥B¥Î javascript ¸}¥»¦b IE (ª©¥»¬O6.0)ùر¹B¦æ¤]¦P¼Ë¦³³o»ò bug ¦s¦b(¤ñ¦p¤U±³o¬q¥N½X)¡CµM¦Ó¦b Firefox ¤¤¹B¦æ´N¬O¨S¦³°ÝÃDªº¡CÁÙ¬O Firefox ¦n°Ú¡A¨þ¨þ!
1234567891011121314151617var re = /[/u00FF-/uFFFF]+/;
¡@¡@// var re = /[/u00FF-/uFFFF]+/i;
¡@¡@for(var i=0; i<0xff; i++) {
¡@¡@var s = String.fromCharCode( i );
¡@¡@if ( re.test(s) ){
¡@¡@alert( 'Should not be matched: ' + i + '!' );
¡@¡@}
¡@¡@}
¡@¡@for(var i=0xff; i<=0xffff; i++) {
¡@¡@var s = String.fromCharCode( i );
¡@¡@if ( !re.test(s) ){
¡@¡@alert( 'Should be matched: ' + i + '!' );
¡@¡@}
¡@¡@}
|
¡]³d¥ô½s¿è¡G¶³¤l¡^