Replace structure How does this regular write?

Source: Internet
Author: User
Replacement structure How do you write the regular?
In the page:
ISO Preface
Introduction
Switch
ISO Preface
Introduction

$ptext is the content of the page. It's like I'm going to use a reverse reference.
PHP Code
  
   
  
   


Guidance.

------Solution--------------------
PHP Code
$s = <<< txt page: ISO preface introduction Txt;echo preg_replace (' # title= ". +?/([^]+)" [^>]+> ([^<]+) < #iU ', ' >$2 < ', $s);
------Solution--------------------
discuss

PHP Code
$s = <<< TXT
In the page:
ISO Preface

------Solution--------------------
([^]+) "[^>]+> ([^<]+)

([^]+) This part is a match URL, the general URL does not exist empty
"Is the end of the URL.
[^>]+> is everything that matches not >, that is, there may be other attributes in that tag. Then to the end of the > Header

([^<]+) This is the content of the tag, there is no < (this is the latter part of the label)


Probably this way, I do not know whether I can say that.
------Solution--------------------
Don't really understand this, .... Divert wrote a

PHP Code
$str =<<
  <><\ div="">
   '; $replace = ' $ $ '; Echo preg_replace ("/$REGEXP/", $replace, $STR);
   
------Solution--------------------
PHP Code
  • <\>

    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.