I could swear there was an identifier for this already, but I couldn't think of it so try this instead:

Code:
get_last_col {
  ;Usage: $get_last_col(<text>)
  ; returns colour last colour codes contained in string (minus colour control code itself)
  ; .pos property returns position of first number
  ; .lpos property returns position of last number
  var %re = /(\d{1,2}(?:,\d{1,2})*)(?:[^]*)$/
  !.echo -q $regex(get_last,$$1,%re)
  if ($prop == pos) return $iif($regml(get_last,1).pos,$ifmatch,0)
  elseif ($prop == lpos) return $iif($regml(get_last,1).pos,$calc($ifmatch + $len($regml(get_last,1)) - 1),0)
  return $iif($regml(get_last,1),$ifmatch,$null)
}


It works with background colours aswell, so text 04,03blah will return 04,03.

Edit: Forgot to add .lpos property
Edit: Fixed .lpos property (I'll get this alias right sooner or later blush)

Last edited by starbucks_mafia; 07/10/03 10:54 PM.

Spelling mistakes, grammatical errors, and stupid comments are intentional.