Using PowerShell to solve three-way test development pen Questions

Source: Internet
Author: User

On the Internet saw three test development of the pen questions, the answer is in Python solution. This is the time to learn about PowerShell, practice:)

1. Verify the mailbox format

2. Get the suffix name of the URL

3. Get the time of the previous day or the previous second

My solution is:

1 #Check Email Format2Write-host"Please input your email address"3 $email=read-Host4 $regular="[A-za-z0-9]\@[a-za-z0-9]\. [A-za-z0-9]"5 if($email -match $regular)6{Write-host"Email is correct, pass!"-Foregroundcolor Green7}Else{8Write-host"Email is wrong, waring!"-Foregroundcolor Red9 }Ten  One #------------------------------------------------------------- A  - #Get the URL name extensions -Write-host"Please input one URL" the $url=read-Host - $extension=($url. Substring ($url. LastIndexOf (".") +1)) -Write-host"The URL extension is:" $extension-Foregroundcolor Green -  + #------------------------------------------------------------ -  + #Get the previous time A $Now=get-Date at $Now. AddDays (-1)#Yesterday - $Now. AddSeconds (-1)#previous Second

Come on! 2017!

Thanks,

Litao

-----Published on Tuesday, November 4:09:35 PM---

Using PowerShell to solve three-way test development pen Questions

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.