mIRC Homepage
Posted By: laz Getting strings between 2 things... - 02/01/03 10:29 PM
Ok I want to get the info between 2 quotation marks. I think I'll explain this better with an example:

%test Hi "Hello" "..." more stuff "BLAH"

Say if I only wanted to get stuff that is in the quotation marks (which would be "Hello ... BLAH").

Any ideas?
Posted By: Lucifer Re: Getting strings between 2 things... - 02/01/03 10:57 PM
/help $gettok
Code:
test {
var %test = $gettok(Hi "Hello" "..." more stuff "BLAH",1,34) $gettok(Hi "Hello" "..." more stuff "BLAH",4,34) $gettok(Hi "Hello" "..." more stuff "BLAH",6,34)
}

that will do what you specified though it could probably be done cleaner you'll just have to look for yourself

Posted By: Hammer Re: Getting strings between 2 things... - 03/01/03 12:40 AM
Code:

alias quoted.stuff.only {
  var %string, %i = $iif("* iswm $1,1,2)
  while ($gettok($1-,%i,34)) { %string = %string $ifmatch | inc %i 2 }
  echo -ati2 " $+ %string $+ "
}

/quoted.stuff.only Hi "Hello" "..." more stuff "BLAH"
"Hello ... BLAH"
Posted By: Nimue Re: Getting strings between 2 things... - 03/01/03 08:46 AM
Code:
alias quoted {
  var %r,%i = 1
  .!echo -q $regex($1-,/\x22(\S*?)\x22/g)
  while ($regml(%i)) { var %r = %r $ifmatch | inc %i }
  if (%r) return $+(",%r,")
}
//echo -a $quoted(Hi "Hello" "..." more stuff "BLAH")
"Hello ... BLAH"
© mIRC Discussion Forums