javascript中的正则表达式有问题吗?

javascript中的正则表达式有问题吗?,javascript,regex,Javascript,Regex,我在javascript中使用正则表达式检查字符串是否包含名为“tagname”的标记。见下文: someText <other>more text<other> </tag-name> someText 更多文本 我想提取“标记名”,仅当它出现在“的第一个实例之后时,您可以使用此正则表达式: /^[^<]*<[^<]*tag-name/ /^[^ <*?tag-name /^[^<]*<[^<

我在javascript中使用正则表达式检查字符串是否包含名为“tagname”的标记。见下文:

    someText
    <other>more text<other>
</tag-name>
someText
更多文本

我想提取“标记名”,仅当它出现在“的第一个实例之后时,您可以使用此正则表达式:

/^[^<]*<[^<]*tag-name/
/^[^
<*?tag-name
/^[^<]*<[^<]*tag-name/