1

The main idea: get all links from all posts. I trying to select data from WP multisites database by the next command:

"select regexp_substr(post_content, '(?<=href=[\'\"])([^\'\"]+)') as link_url from wp_${id}_posts where post_type = 'post' or post_type = 'page'"

But regexp_substr return only first occurrence. I meam return only first occurrence from each post, from table post_content. What I lost? Thanks.

  • Can you post an example with test data: `post_content` (input) and expected result? – wchiquito May 01 '20 at 17:35
  • Just any text with any number of links. The result is link url - for example "http:// domain.com/some/page-url/". So the main idea is get all links from each post/page. – Oleksandr Slavko May 03 '20 at 08:49
  • [`REGEXP_SUBSTR`](https://mariadb.com/kb/en/regexp_substr/) seems to return only the first occurrence. An option that may be useful is [`EXTRACTVALUE`](https://mariadb.com/kb/en/extractvalue/), see [dbfiddle](https://dbfiddle.uk/?rdbms=mariadb_10.4&fiddle=c2eb9a4b43418b80735dfaf40bea1d48). – wchiquito May 03 '20 at 10:39

0 Answers0