[英]Regex match function in Javascript
我正在使用一個積極的前瞻性正則表達式來獲取匹配的字符串,但它給我在IE8 Syntax error in regular expression
中的Syntax error in regular expression
我做錯了什么。 我想匹配第一次出現。
匹配輸入
<IMG title="Configuration older than 90 days" alt=true src="http://indwdev:6130/include/images/expired.png"><IMG title="Converted configuration" alt=true src="http://indwdev:6130/include/images/convert.png">
我的正則表達式str.match(/(?<=Converted configuration" alt=)[\\w]+(?=)/)
這是一個jsfiddle鏈接 。
Javascript在其正則表達式中不支持正面的lookbehinds。 您可以使用
str.match(/Converted configuration" alt=([\w]+)/)[1]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.