PHP programming: How to specify Regular Expressions for different content

Source: Internet
Author: User
Tags php source code

Introduction: This is a detailed page for PHP programming to specify Regular Expressions for different content. It introduces PHP, related knowledge, skills, experience, and some PHP source code.

Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 325728 'rolling = 'no'>
The regular expression in the PHP tutorial specifies the difference content.

*/

$ STR = "{Dede: link text = 'it bubble thup'} http://www.3ppt.com/5j/game/2011/03/04/hs60v3.sisx {/Dede: link}

";

$ Link = array_filter (explode ('{/Dede: link}', $ Str), "filter ");

$ Len = count ($ link );

For ($ I = 0; $ I <$ len-1; $ I ++)

{

$ Tpattern = "/{Dede: link text = '(. *)'}/I ";

$ Ppattern = "/'} (. *)/I ";

Preg_match_all ($ tpattern, $ link [$ I], $ title );

Preg_match_all ($ ppattern, $ link [$ I], $ PATH );

Echo '<a href ='. $ path [1] [0]. '>'. $ title [1] [0]. '</a> & nbsp ;';

}

Function Filter ($ var)

{

If ($ Var = ''| $ Var = '')

{

Return false;

}

Return true;

}

More articles on "How to specify Regular Expressions for different content in PHP programming"

Love J2EE follow Java Michael Jackson video station JSON online tools

Http://biancheng.dnbcw.info/php/325728.html pageno: 13.

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.