devslashneil has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,
I am writing a small script for Irssi which counts the number of people that say a certain phrase. The problem is that my test fails when the phrase is said using different colors for each letter of the text. I was wondering if anyone had come across this problem before and if so what their solution was?

Thanks a lot

Neil Archibald
- /dev/IT -

Replies are listed 'Best First'.
Re: Irssi scripting - Ifnoring Color
by talexb (Chancellor) on Jul 11, 2003 at 05:09 UTC

    Different colours? What haven't you told us about this problem? I only see black on white in your original message. Are you talking about HTML by any chance?

    --t. alex
    Life is short: get busy!

    ps Thanks so much to few dolts who --ed my reply. I was just trying (in my somewhat brutish way) to help the original poster more closely define his/her problem. Have a lovely day.

      Sorry if i didn't make that clear, Irssi is a console based irc client. It used control characters representing differnt colors to symbolize color changes.
      Therefor my string  "Hello, World" when in color may end up as "H[ctrl-k],4e[ctrl-k]llo, World".
      I was thinking of writing a regex to extract the color from all input but that would probabbly slow down irc a bit and i'm sure there is a better way. I would assume irssi has a method of removing color from text built in though?

      Neil Archibald
      - /dev/IT -
        Well, if you ask in this forum, using the regex is the most likely answer to get. This being a Perl forum, and not a specific application forum. This is not a good place to ask questions about the feature set of the API of 'irssi'.

        Of course, you could always modify the source of 'irssi' and take out the colouring bits.

        Abigail