/* * replacement for $nopath which is uber slow ! * coded by LtGuide using mIRC v6.16 on 1 April 2004 */ alias _nopath { /* * variables filepath to hold user input * and regex for our regex matching pattern * and result for the result of our calculations */ var %filepath = $1,%regex = /^(.*:(\\|/).*|)[^\\/]+$/,%result = $null /* * verify that we have user input and a valid file path ($regex) */ if ((%filepath == $null) || ($regex(%filepath,%regex) == 0)) { /* * so, return the return variable since we have error */ return %result } /* * variable position to hold the position of the last \ in * file path ($pos) based on the count of \'s ($count) */ var %position = $pos(%filepath,\,$count(%filepath,\)) /* * checking if the position of the last / in file path ($pos) * based on the count of /'s ($count) is greater than the * current value of position */ if ($pos(%filepath,/,$count(%filepath,/)) > %position) { /* * so, set position to hold the highest position of / ($ifmatch [first parameter of matching if-then-else comparison]) */ var %position = $ifmatch } /* * save our calculations in result: * take X characters from the right ($right) of the inputted file path * X being the length ($len) of the file path minus the position */ var %result = $right(%filepath,$calc($len(%filepath) - %position)) /* * return that result! */ return %result }