#!ruby -p gsub(/(\D)?(\d+)(x(\^(\d+))?)?/){[$1,$4?[$2.to_i*e=$5.to_i,:x,([:^,e-1]if e>2)]:$2]if$3}
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page