If you filter the first decimal point

Source: Internet
Author: User
Ask the experts if they want to filter out the first decimal point? The obtained URL may be in the following format: baidu.com.baidu.com & nbsp; $ name = substr ($ name, 1); the result obtained by filtering .baidu.com is correct, however, if you encounter a problem similar to baidu.com, you can filter it to aidu.com. if you want to filter the first decimal point, ask the experts for the code you want to use?
The URL format may be as follows:
Baidu.com

.Baidu.com


Use
$ Name = substr ($ name, 1 );

The result obtained by filtering .baidu.com is correct, but if you encounter a problem similar to baidu.com, it will be filtered into aidu.com. please ask what code can be used to filter vertices a bit earlier. if there are no vertices, it will not be filtered?


Let:
Baidu.com or .baidu.com are all baidu.com.


------ Solution --------------------
PHP code
[User: root Time: 11: 47: 47 Path:/home/liangdong/php] $ php preg. php baidu.com [User: root Time: 11: 47: 48 Path:/home/liangdong/php] $ cat preg. php

  

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.