Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有更简单的方案写法
(eqv?(正则表达式匹配“0x”“0x1234”)#t)
#F
(eqv?(正则表达式匹配“0x”“1234”)#f)
#t
那将是
(regexp-match? #rx"0x" "...some-string...")
请注意,这#rx意味着正则表达式已预编译并包含在您的代码中。这样做也更好,因为它可以保护您免于编写混淆代码和交换参数。
#rx
顺便说一句,像
(regexp-match? #rx"^0x" "...some-string...")
可能更有用。
另请参阅指南页面以了解如何在 PLT 中使用正则表达式,并参阅参考页面 以获取完整说明。