| |
| |
| |
|
Page: 1 2 3 4 5
Comments:
<argv[0]> its overly complex. <maZtah> is it? <argv[0]> to do it without regex? yea <maZtah> bleh <argv[0]> which part are you trying to process <argv[0]> the message or the full line <maZtah> full line, i guess <argv[0]> you guess? <maZtah> haven't thought about a solution yet, just wanted to know if it's useful to code without the use of a regex <sat> what are you trying to do at all? <sat> check a random [ ] box? <maZtah> like a poll with a random answer <argv[0]> i would just do tokenize 93 $gettok($1-,%i,91) <maZtah> yep <argv[0]> $1 would be the X (or not) and $2- would be the reason <argv[0]> ***uming you're at the line part and not the timestamp/nick <maZtah> mhh? <argv[0]> oh wait, <sat> yeah, its fairly easy without regex as well <argv[0]> i mean, var %line = $1- and tokenize 93 $gettok(%line,%i,91) <sat> just use $count $pos $left and $mid <argv[0]> ew. <maZtah> hmm <maZtah> $count(string,substring,substring2,...,substringN) <maZtah> Returns the number of times substring occurrs in string. <maZtah> ah :) <maZtah> 1 <maZtah> 2 <maZtah> hah <argv[0]> 3. <argv[0]> //var %i = 1, %line = [x] hello [[ ]] world | while ($gettok(%line,%i,91)) { tokenize 93 $v1 | echo -a checked: $iif($2,YES,NO) comment: $iif($2,$2,$1) | inc %i } <sat> nice 'n all, but that's not what he asked :p <argv[0]> isnt? <maZtah> not really <maZtah> sat: where to use that $mid for? <argv[0]> oh you're generating the output with no input? or you're taking input and generating output? <sat> well.. as easy replacement for $right <sat> you'd want everything left and everything right from the place where you want to put an X in <sat> i'd use $mid for the right part, because it's simpler than using $right <sat> lemme just give you my solution <sat> alias checkrandombox { if ($pos($1-,[[ ],$rand(1,$count($1-,[[ ])))) return $+($left($1-,$v1),X,$mid($1-,$calc($v1 + 2))) } <maZtah> can't i use an instok @ N place? <sat> you can try <maZtah> hmm <sat> but i'm curious as to what C you'd use in that case ;) <maZtah> a 'X' ? <sat> you don't have a 'X' to begin with <sat> you could use 93 like arg did i suppose, but i doubt it'll get any easier that way <maZtah> [] test [] test2 <maZtah> hihi <maZtah> ;( <sat> err, please test elsewhere <maZtah> sorry <maZtah> hmm, i'm tired, will try again tomorrow <maZtah> thanks anyways! <sat> :) np <argv[0]> http://www.holycraplions.com/paste/1298 <argv[0]> heh <sat> :/ <argv[0]> dynamic regex generation would be so much nicer <argv[0]> / $+ $str(([\s+]).+?,$count($1-,$chr(91) $chr(93))) $+ / <argv[0]> or somethin <argv[0]> it worked in my head, but i have to go <argv[0]> so lata <sat> o/ <argv[0]> //var %n = 3 | echo -a /(?< $+ $remove($reptok($str([\s+] .+? $chr(32),3), [\s+], $chr(41) $+ ([\s+]) $+ $chr(40) $+ ?=, $rand(1,%n), 32),$chr(32)) $+ )/ <argv[0]> ? <argv[0]> i dont know lookahead/behind syntax <argv[0]> oh that wouldnt work anyway <argv[0]> good try though, this time im gone for real <sat> no $rand ? <sat> oh there it is, nm <argv[0]> yea but lookbehind doesnt support variable lenghts <sat> yeah that ****s <argv[0]> i guess you could just do \1 \2 \3 <argv[0]> //var %n = 3 | echo -a /( $+ $remove($reptok($str([\s+] .+? $chr(32),3), [\s+], $chr(41) $+ ([\s+]) $+ $chr(40), $rand(1,%n), 32),$chr(32)) $+ )/ <argv[0]> //var %n = 2, %re = /( $+ $remove($reptok($str([\s+] .+? $chr(32),3), [\s+], $chr(41) $+ ([\s+]) $+ $chr(40), $rand(1,%n), 32),$chr(32)) $+ )/ | echo -a %re => $regsubex([ ]] hello [[ ]] world, %re, \1 [X] \3) <argv[0]> almost works <sat> werent you going or something <sat> ;p <argv[0]> i realized i dont have to leave just yet <argv[0]> and this is too much fun to p*** up <sat> heh
Return to
#mirc or Go to some related
logs:
#stocks #dsl #heroin #stocks #hardware #politics gog and magog America Usage: date [OPTION]... #windowsxp spartigis
|
|