Ignore first character in regex match

I need to ignore >in my regex first.

My regex is:

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

Corresponds to the following:

enter image description here

How do I say to be ignored at first >?

Here is the regex on regexr.com.

+6
source share
2 answers

A possible workaround is to match non- >characters:

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

regex101 demo

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

+8
source

You can use:

.*?>(\w+)<

Regular expression visualization

Here you can check a working example:

Demo version of Debuggex

+4
source

Source: https://habr.com/ru/post/1546621/


All Articles