0

I am using a positive lookahead regex to get the matched string, but it gives me Syntax error in regular expression in IE8 what am I doing wrong. I want to match the very 1st occurrence.

Matching input

<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">

My regex str.match(/(?<=Converted configuration" alt=)[\w]+(?=)/)

Here is a jsfiddle link.

3
  • 2
    Are you sure you dont want to parse it instead? Commented Dec 10, 2012 at 8:00
  • @AlexWayne: how can this be parsed? Commented Dec 10, 2012 at 9:07
  • 1
    If the input is HTML, you can use jQuery to parse the HTML and search through the DOM as per normal. Regex is a sub par solution in this case. Commented Dec 10, 2012 at 10:15

1 Answer 1

2

Javascript doesn't support positive lookbehinds in its regexes. You can use

str.match(/Converted configuration" alt=([\w]+)/)[1]
Sign up to request clarification or add additional context in comments.

1 Comment

I want to fetch true in this case

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.