2, the regular expression of one of the advanced _

Source: Internet
Author: User

#!/usr/bin/perlforeach $var(Glob("*.wav")){        #$var =~/.* (00.*). wav/;        $var=~ /.*(xx\d\d). wav/; $Newvar='spkcontext_zj_'.$1.'. wav'; system("MV $var $Newvar"); Print "Now is processing $var \ n";}Print "Over \ n";
    1. To use a more accurate regular expression, do not use fuzzy regular expressions:
      1. For example, the file name is as follows:spkcontext_0001.wav
      2. We're going to capture, where 0001 of these 4 strings (or maybe called numbers), I now have two ways of writing:
        1. $var =~/.* (xx. *). wav/;

        2. $var =~/.* (xx\d\d). wav/;

      3. The above two types of writing, of course, the second one is more specific, more accurate.
      4. In the first form, the question that arises is:
        1. The captured variable has a value of 001, not 0001
        2. The second way of writing does not occur.

2, the regular expression of one of the advanced _

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.