سؤال

I'm trying to just preg content between html tags, I'm trying this simple assertion pattern and I don't understand why it doesn't match this string.

<a href=http://url.com title="link">this is a ling</a>

(?<=<a.*>)([ \w]*)(?=<.*\/a>)

Debuggex Demo

هل كانت مفيدة؟

المحلول

Lookbehinds on debuggex (PCRE, Javascript and Python) cannot be of variable width, meaning that you can use (?<=<a>) which has a fixed width (3 characters) but not something that can vary in length (?<=<a.*>) (can have 3 characters, or 4, or 5, etc).

The regex simply is not valid but debuggex tells you that there is no match.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top