diff --git a/nemu/src/monitor/debug/expr_impl/lexer.l b/nemu/src/monitor/debug/expr_impl/lexer.l
index 7da3a976745e2d8c9538133338f0256f497f38be..f1cfff1123058cc600be744ecbba178fb79a96e6 100644
--- a/nemu/src/monitor/debug/expr_impl/lexer.l
+++ b/nemu/src/monitor/debug/expr_impl/lexer.l
@@ -19,6 +19,6 @@
 "&&"          {return T_LOGICAL_AND;}
 [-+*/()]      {return yytext[0];}
 
-"%"[a-z]{3}   {yylval.ival = ((uint32_t)yytext[1] << 8) + yytext[2]; return T_REG;}
+"%"[a-z]{3}   {yylval.ival = ((uint32_t)yytext[2] << 8) + yytext[3]; return T_REG;}
 %%
 // Registers: eax='a'+'x', ebx='b'+'x', ...