10

I need to ignore the > in my regular expression in the beginning.

My regular expression:

/(>(.+)(?=<\/a>))/igm

Matches the following:

enter image description here

How do I tell it to ignore the > in the beginning?

Here is the regular expression on regexr.com.

Asad Shakeel
  • 1,547
  • 1
  • 19
  • 26
Matthew
  • 1,978
  • 6
  • 26
  • 49

2 Answers2

12

Possible workaround would be to match non > characters:

[^>]+(?=<\/a>)

regex101 demo

Or you take the substring of each of your results in the code itself.

Jerry
  • 68,613
  • 12
  • 97
  • 138
  • Thank you! I was using `.splice(1)`, but it said it can't splice from null. so then I had to add `.toString()` – Matthew Jun 30 '14 at 20:48
5

You can use:

.*?>(\w+)<

Regular expression visualization

Here you can check a working example:

Debuggex Demo

Federico Piazza
  • 28,830
  • 12
  • 78
  • 116