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) * $