regex - How to match digits in perl glob -


  $ dir_path = (-d ("./abc/dir-\d.\d.\d" ))? ग्लोब ("। / abc / dir- \ d। \ d। \ d / my-dir *"): "my-dir-doesnot-exist";   

क्या यह एक मान्य ग्लोब विकल्प है? क्या मैं डीआईआर पथ में संख्याओं से मिलान करने के लिए \ d का उपयोग कर सकता हूं?

$ dir_path को मिलना चाहिए "./abc/dir-#.#.#/my-dir/some_dir_name" if "./abc/dir - #। #। # "मौजूद है (जहां # कोई अंक है) और" मेरे-डायर-कोई-मौजूद नहीं "स्ट्रिंग

आप scalar संदर्भ में (लेकिन एक इटरेटर के रूप में नहीं) में glob के दोनों उदाहरणों को बुला रहे हैं जो बहुत गलत है उदाहरण के लिए,

  मेरी $ foo = glob ("a"); मेरी $ bar = ग्लोब ("a"); $ foo // "[undef]" कहना; # एक कहना $ बार // "[undef]"; # [अनफफ]   

ग्लोब भाषा रीजेक्स भाषा से बिल्कुल अलग है \ d काम नहीं करेगा, लेकिन [0123456789] होगा।

  my @dir_paths = glob ("। / Abc / dir- [0123456789] [0123456789] [0123456789] / मेरी-निर्देशिका * ")।। मर "कोई मैच नहीं!" अगर! @ डीर_पाथ; मर "बहुत सारे मैचों!" अगर @dir_paths & gt; 1; मेरी $ dir_path = $ dir_paths [0];    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

Installing croogo for cakephp -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -