$read with case sensitivity - 16/01/11 06:41 AM
Almost every thingy has it so far.
Would be very handy together with wildmask search.
Would be very handy together with wildmask search.
//echo -a $replacex(hello,e,l,l,x) != $replace(hello,e,l,l,x)
echo -a $read(file,w,*foo*) echo -a $read(file,r,foo)
echo -a $read(file,w,foo*) echo -a $read(file,r,^foo)
echo -a $read(file,w,*foo*bar*) echo -a $read(file,r,foo.*bar)
alias wre return $+(/^,$replace($regsubex($1,/([|\/\\\[\](){}$^.])/g,\\1),*,.*,?,.,&,\S+),$!/,$2)
echo -a $read(file,r,$wre(*foo*bar*,i)) echo -a $read(file,r,$wre(*foo*bar*))
$replace(hello,e,y,l,x,y,l)
//echo $replace(abcd,a,b,b,z)
//echo $replacex(abcd,a,b,b,z)
//echo $replace(hello,e,y,l,x,y,l)
//echo $replacex(hello,e,y,l,x,y,l)
//echo -a $replacex(hello,e,l,l,x) != $replace(hello,e,l,l,x)
alias test { echo -a $iif(? iswm $null,yes,no) ~ $regex($null,/^.?$/) echo -a $iif(?a iswm a,yes,no) ~ $regex(a,/^.?a$/) echo -a $iif(?a iswm ba,yes,no) ~ $regex(ba,/^.?a$/) echo -a $iif(a? iswm ab,yes,no) ~ $regex(ab,/^a.?$/) echo -a $iif(a? iswm a,yes,no) ~ $regex(a,/^a.?$/) }
alias wmcs2re return $+(/(*UTF8)^\Q, $regsubex($replacecs($1, \E, \E\\E\Q, *, \E.*\Q, ?, \E.\Q), /&(?= |$)/g, \E[^ ]+\Q), \E$/s)
$Wc2Re(wildcard text) -> Converts a wildcard matching pattern to a regular expressions $Wc2Re(wildcard text).cs -> THe return regular expression is case sensitive alias Wc2Re return $+(/(*UTF8)^,$regsubex($1-,/([\Q$^|[]{}()\/.+\E])|(&(?= |$))|([?*]+)/g,$Wc2Re:Rep(\t)),$,/s,$iif($prop != cs,i)) alias -l Wc2Re:Rep { if ($1 == &) return \S+\b if (* !isin $1 && ? !isin $1) return \ $+ $1 if (? !isin $1) return .* if ($count($1,?) < 5) return $str(.,$v1) $+ $iif(* isin $1,+) return $+(.,$chr(123),$count($1,?),$iif(* isin $1,$chr(44)),$chr(125)) }