For the regex gurus. - 06/08/05 11:12 PM
var %f = $regsub(%a,/\G(?!.*\b(?:calculus|square|root|-1|negative)\b)(.*?)\bi\b/g,\1I,%a)
This makes "So i need help" to become "So I need help" by capitalizing the letter I.
"The square root of negative 1 is i" does not capitalize i.
However, type /umode +i becomes +I.
I need for it to not include +/- signs before and after it.
2.
How do I make arent aren't? (Not via $replacecs because parents becomes paren'ts).
3.
This is exactly the same as a /names, and I need it for remaining users only.
3.
Sorry but I still see /mode # b in my status, the purpose is to hide it.
4.
Also, how do I return the first letter of every word in a $1- string. I'm trying to bold every first letter of every word, but I can only bold the first letter of the first and last word, not the words in between.
5.
/totalchannel {
var %n = $scon(0), %totalchannel = 0
while (%n) {
scon %n
inc %totalchannel $chan(0)
dec %n
}
return %totalchannel
}
That returns total channel windows. So it counts channel windows that I may not be in, like disconnects and kicks. How do I return "joined" channels?
Basically, I need to return "$chan(0).status" for 'joined' only.
Thanks.
This makes "So i need help" to become "So I need help" by capitalizing the letter I.
"The square root of negative 1 is i" does not capitalize i.
However, type /umode +i becomes +I.
I need for it to not include +/- signs before and after it.
2.
How do I make arent aren't? (Not via $replacecs because parents becomes paren'ts).
3.
Code:
alias RemainingUsers { ; Create the matchtext field for raw 353 and 366 to trigger on ; set -u600 %353 $me & #$$1 * set -u600 %366 $me #$1 End of /NAMES list. ; Open a minimized, hidden desktop listwindow to store the nicks ; it's entirely possible that this ; alias might be used on a channel with a large number of nicks (like 2500) which makes storing ; the nicks in a variable untenable. And since (join) order is quite likely important, a hash table ; wouldn't be the best idea either. That leaves either a file (slow access) or a hidden @window. window -nhdl @RemainingUsers ; Now request the join order from /NAMES. .raw names #$1 } ; 353 RPL_NAMREPLY raw 353:%353:{ ; Remove the @'s and +'s from in front of nicks. If your network uses additional symbols in front ; of nicks, add them to the list of symbols inside the $remove(). var %rnicks = $remove($4-, @, +) ; Check to see if there are already nicks in @RemainingUsers, which would mean that we've found $me ; somewhere in a previous 353. if $line(@RemainingUsers, 0) { ; Since $me is already in @RemainingUsers, add all these new nicks to variable. var %nicks = %rnicks } ; Or if $me is found in this line, then we can start processing nicks elseif $istok(%rnicks, $me, 32) { ; Chop off any nicks prior to $me. var %nicks = $gettok(%rnicks, $+($findtok(%rnicks, $me, 1, 32), -), 32) } ; Now check to see if we need to process this 353 any more. if (%nicks) { ; Add each nick to @RemainingUsers var %i = 1 while $gettok(%nicks, %i, 32) { aline @RemainingUsers $ifmatch inc %i } } ; Halt the normal display. halt } ; Echoing alias for /filter -k used in RPL_ENDOFNAMES to display the nicks. alias -l f_echo { echo -gtic info2 $gettok(%366, 2, 32) $1 } ; 366 RPL_ENDOFNAMES raw 366:%366:{ ; Get rid of the first line, which will be equal to $me. dline @RemainingUsers 1 ; Display the list however you like. This example uses /filter with an alias to echo. filter -k @RemainingUsers f_echo ; Clean up the /set variables used and close the data window. unset %353 %366 window -c @RemainingUsers ; Halt the normal display. halt }
This is exactly the same as a /names, and I need it for remaining users only.
3.
Code:
on me:*:JOIN:#: hadd -mu600 MeJoin $+($cid,#) 1 | .raw $+(MODE # b,$crlf,WHO #) raw 352:*: if ($hget(MeJoin, $+($cid,$2))) halt raw 315:*: if ($hget(MeJoin, $+($cid,$2))) { hdel MeJoin $+($cid,$2) | halt } raw 367:*: if ($hget(MeJoin, $+($cid,$2))) halt raw 368:*: if ($hget(MeJoin, $+($cid,$2))) halt
Sorry but I still see /mode # b in my status, the purpose is to hide it.
4.
Also, how do I return the first letter of every word in a $1- string. I'm trying to bold every first letter of every word, but I can only bold the first letter of the first and last word, not the words in between.
5.
/totalchannel {
var %n = $scon(0), %totalchannel = 0
while (%n) {
scon %n
inc %totalchannel $chan(0)
dec %n
}
return %totalchannel
}
That returns total channel windows. So it counts channel windows that I may not be in, like disconnects and kicks. How do I return "joined" channels?
Basically, I need to return "$chan(0).status" for 'joined' only.
Thanks.