11

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,949
  • 1
  • 23
  • 29
Matthew
  • 2,158
  • 7
  • 30
  • 52

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
  • 70,495
  • 13
  • 100
  • 144
  • 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
  • 30,085
  • 15
  • 87
  • 123