Regular expression rules after line feed

Source: Internet
Author: User
Regular expression indicates the rule after line feed. this is the content tip_lb_jianjie "& gt; updated on: & nbsp; 00:42:36 & lt; br & nbsp;/& gt; content preview: & nbsp; "Stop !? Who are you !?" Soldiers outside the compound raised the & nbsp; in their hands to express the rules after the new line,
This is the content

Tip_lb_jianjie "> Last Updated: 00:42:36
Content preview:
"Stop !? Who are you !?"

Soldiers outside the compound raised their hands a bit strange.

...



$ Guize2 = "/tip_lb_jianjie \"> Update Time \:(.*?) [\ N * | \ r *] * content preview :(.*?) /I ";


You can get a time, but you cannot get the content. I also use \ n \ r for line breaks. But it cannot be matched.
Let me see. Shared to: Updated on? 00:42:36 Content preview :? "Stop !? Who are you !?" Soldiers outside the compound raised their hands ?... 'Data-pics = ''>
------ Solution --------------------
$ S = <TXT
Tip_lb_jianjie "> Last Updated: 00:42:36
Content preview:
"Stop !? Who are you !?"
 
Soldiers outside the compound raised their hands a bit strange.
 
...
TXT;
$ P = "/tip_lb_jianjie \"> Update Time :(.*?) . * Content preview :(.*?) <\/Div>/is ";
Preg_match_all ($ p, $ s, $ r );
Print_r ($ r );
Array
(
[0] => Array
(
[0] => tip_lb_jianjie "> Last Updated: 00:42:36
Content preview:
"Stop !? Who are you !?"
 
Soldiers outside the compound raised their hands a bit strange.
 
...
)

[1] => Array
(
[0] => 00:42:36
)

[2] => Array
(
[0] =>
"Stop !? Who are you !?"
 
Soldiers outside the compound raised their hands a bit strange.
 
...
)

)

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.