[英]Node.js Path module source two regular express
我對node.js路徑模塊源中的2個正則表達式感到困惑
// Regex to split a windows path into three parts: [*, device, slash,
// tail] windows-only
var splitDeviceRe =
/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
// Regex to split the tail part of the above into [*, dir, basename, ext]
var splitTailRe =
/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/;
劑量splitTailRe如何工作? 與該組最混淆的: "((?:\\.{1,2}|[^\\\\\\/]+?|)(\\.[^.\\/\\\\]*|))"
這可能對您有所幫助
splitDeviceRE = https://regex101.com/r/mV5gS0/2
splitTailRe = https://regex101.com/r/mV5gS0/1
它分解了您輸入的正則表達式,並逐步解釋了正則表達式的每個“部分”在做什么。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.