PHP Development article within the chain, a related issue of substitution rules

Source: Internet
Author: User
PHP Development article within the chain, a problem with the replacement rule
Do the inner chain method, can think of is to replace the set of good inner chain words, such as the "Spring Festival holiday" replaced with "Spring Festival Holiday", and so on, this way to

But the fact may not be so simple, because the article is often sent with HTML tags, such as may be " Spring Festival Holiday"In this form, how to replace it?"

Thought maybe there might be a concentration below.

"Spring Festival Holiday"This is to be replaced, into such a" spring festival Holiday”

This direct form of "Spring Festival Holiday" does not replace

“ Spring FestivalHoliday "This type of label is not replaced

"Spring Festival Holiday" This part of the word has a link does not replace

。。。 Maybe there's a situation for him.

In the language description, "Every word is replaced without a link, the link may be a direct link may also be a tag link"

Then replace it with "multiple word breakers within the nearest parent node, replacing the new form with the newly Added link".

How do you write the matching rules and the substitution rules? Help PHP SEO Inner Chain


------Solution--------------------
You're so complicated, you don't need to be replaced by HTML tags.
Because the tag may have been given a specific meaning, such as a tag is a connection
Although you think it is very complicated, but there is another place not to consider (inside the tag):
Spring Festival Holiday' > Spring Festival Holiday
Example
$html = <<
 <>
Here is the link to the tea.

Chinese tea
Here is a link to the Chinese tea panorama.
Here is the existing link to the tea
html
echo preg_replace (' # =[^>]* (?=< (?! /a>)
------Solution--------------------
($)) Tea # ', ' (') ', $html);
Get

Here is the link to the tea.

Chinese Tea
Here is a link to the Chinese tea panorama.
Here is the existing link to the tea
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.