Filter out some character problems

Source: Internet
Author: User
Filter some questions 91w.colw.dosing and row%97%col%jiaotilizi.gif # row #98 # col # extraction # row #99 # col # FenPeiXiShu. GIF # row # structure is like this: id + # col # + name + # row #91 # col # neutralization # row #97 # col # JiaoTi filter out some characters
91#col1_dosing and %row%97%col%jiaotilizi.gif # row #98 # col # extraction # row #99 # col # FenPeiXiShu. GIF # row #

The structure is as follows: id + # col # + name + # row #
91 # col # neutralization # row # 9720.col1_jiaotilizi.gif # row #

A lot of such data should be processed out of gif

PHP code
  $contents = preg_replace('/[\w]#col#(.*?).gif#row#'/i,'',$contents);


I want to replace it with NULL. Isn't this a good method?
And this regular expression is incorrect.

------ Solution --------------------
If fixed strings are processed, use the str_replace () function.
------ Solution --------------------
So?
PHP code
$ Str = "91w.colw.lizi.gif # row #98 # col # extraction # row #99 # col # FenPeiXiShu. GIF # row # "; $ str = preg_replace ('/# [\ d?##col==a-z?#.gif # row #/is', '#', $ str); echo $ str;
------ Solution --------------------
PHP code
$ Contents = preg_replace ('/(col # [^ \.] + )\. gif (# row)/I ',' $1 $ 2', $ s); echo $ contents;
------ Solution --------------------
PHP code
When string'91w.colw.com and then row%97%col%jiaotilizi.gif # row #98 # col # extraction # row #99 # col # FenPeiXiShu. GIF # row # '; echo preg_replace ('/\ d * # col # [^ #] * (? <= Gif) # row #/I ', '', $ str );

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.