微信扫码登录
2
101
1261
金牌会员
使用道具 举报
// 假设IP在 msg.ip 中 if (msg.ip && typeof msg.ip === 'string') { // 使用正则表达式匹配IP地址开头的数字 // ^\d+ 匹配字符串开头的一个或多个数字 const match = msg.ip.match(/^\d+/); if (match) { // 如果匹配成功,match[0] 就是我们想要的结果 msg.ip = match[0]; } else { msg.ip = "Error: No leading digits found"; } } else { msg.ip = "Error: Invalid input"; } return msg;
本版积分规则 发表回复 回帖后跳转到最后一页
Archiver|手机版|小黑屋|Hassbian ( 晋ICP备17001384号-1 )
GMT+8, 2026-1-9 00:05 , Processed in 0.626446 second(s), 10 queries , MemCached On.
Powered by Discuz! X3.5
© 2001-2025 Discuz! Team.