Javascript 获取同一页面正则表达式中的哈希链接

Javascript 获取同一页面正则表达式中的哈希链接,javascript,css,regex,hash,Javascript,Css,Regex,Hash,我想得到的哈希链接,这是针对作为部分在同一页。 假设我有一个链接,我有一个id为todo的部分:。现在首先我想检测它是否是一个带有散列的链接,然后抓取目标并滚动到目标 我的js是 但这并不能安慰任何事情 string.match(regexp) regexp.exec(string) regexp.test(string) 一切都存在regexp.match(字符串)不是一件事 string.match(regexp) regexp.exec(string) regexp.test(strin

我想得到的哈希链接,这是针对作为部分在同一页。 假设我有一个链接
,我有一个id为
todo
的部分:。现在首先我想检测它是否是一个带有散列的链接,然后抓取目标并滚动到目标

我的js是 但这并不能安慰任何事情

string.match(regexp)
regexp.exec(string)
regexp.test(string)
一切都存在
regexp.match(字符串)
不是一件事

string.match(regexp)
regexp.exec(string)
regexp.test(string)