U_TRS1=000000a8.c806787c.51d722dc.b3c448d5; path=/; expires=Mon, 03-Jul-23 19:47:40 GMT; domain=.sina.com.cn U_TRS2=000000a8.c812787c.51d722dc.2dc642a0; path=/; domain=.sina.com.cn SUS=SID-1732181301-1373053660-JA-i687l-43ba25d4105f398433583b51158d83c2; path=/; domain=.weibo.com; httponly ALF=1375645660; expires=Sun, 04-Aug-2013 19:47:40 GMT; path=/; domain=.weibo.com SSOLoginState=1373053660; path=/; domain=.weibo.com USRUG=usrmdins413_202; path=/
我有一个文件,文件内容如上所示,文件里以 \n 做为换行符,我现在想匹配出以 ALF 开头的一行字符串,怎么做,我尝试了好几个都失败了
var fs = require(‘fs’); var get_cookie = fs.readFileSync(cookie_file, ‘utf8’); var A = get_cookie.match(new RegExp("(^| )ALF=([^;]*)(\n$)"));
求正则完成这个工作