How to solve regular expression exclusion

Source: Internet
Author: User
Regular expression exclusion if I have the following rows of data: "hello, I am world" "hello, my & nbsp; name & nbsp; is" "The address is: http://www.baidu.com "I want to extract the line that does not contain the" http "string, that is, the first two lines, how to write a regular expression? regular expression exclusion
If I have the following rows of data:

"Hello, I'm world"
"Hello, my name is"
"Address: http://www.baidu.com"

I want Extract rows that do not contain the "http" stringThat is, the first two rows. how do I write a regular expression?
------ Solution --------------------
Split it into arrays by line breaks, and then filter the arrays.
------ Solution --------------------
Reference:
Well, I know the idea. now I just don't know how to write regular expressions.
I use
'(?! Http )'
Filtering, no effect

A temporary solution is as follows:
Preg_match_all ('/\".*? (? : Http .*?) \ "/', $ Str, $ math );
Print_r ($ math );

Obtain the string line containing http, and then replace str_replace
------ Solution --------------------
What do you want to do with regular expressions? just search for each element in strpos.
------ Solution --------------------
Http://blog.sina.com.cn/s/blog_53df94780100crty.html
Participate
------ Solution --------------------
Regular expression exclusion is generally written in this way.
((?! The string to be excluded).) +?

Http://iregex.org/blog/negate-match.html
------ Solution --------------------
^ (.(?! Http) * $

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.