Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8784091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:59:57+00:00 2026-06-13T20:59:57+00:00

I’d like to extract texts from irc logs. I have regular IRC log from

  • 0

I’d like to extract texts from irc logs. I have regular IRC log from irssi like this:

00:12 -!- Barbora [post@gw1-nat-041.roburnet.sk] has joined #post.sk
00:12 -!- mirinda [~post@195.91.55.136] has quit [Broken pipe]
00:12 -!- rogue1 [post@86-41-114-24-dynamic.b-ras2.lmk.limerick.eircom.net] has joined #post.sk
00:12 -!- Komunista is now known as Anonym9901
00:13 -!- ajka [~post@78.141.102.209] has quit [Client exited]
00:16 < blackmamba> no fuj
00:16 < blackmamba> Komunista: lol
00:16 < blackmamba> "este trochu"
00:16 < blackmamba> "je taky velky"
00:17 -!- majopo [post@adsl-d192.84-47-63.t-com.sk] has quit [Client exited]
00:19 -!- Anonym9901 is now known as Komunista
00:19 -!- dido84 [post@BSN-143-83-49.dial-up.dsl.siol.net] has quit [Client exited]
00:19 < Komunista> no?
00:20 < Komunista> ja by som*nadavka*l
00:20 < Komunista> ako pes
00:20 -!- Komunista is now known as Anonym53560 

What I need is output like this:

no fuj lol este trochu je taky velky no ja by som*nadavka*l ako pes

So, just words separated by whitespace, nothing else, no nicks, no quotationmarks, questionmarks etc. I need it as input for LDA.

Nicks I will remove by postprocessing, it will be easier I think, or?

I prefer PHP with regex, I’m not good at it, that’s why I ask you all for help.

Thank you for your time!

EDIT:

Now I use this code (Thank to m.buettner):

$input = ... ;
$smiles = [">:]", ":-)", ":)", ":o)", ":]", ":3", ":c)", ":>", "=]", "8)", "=)", ":}", ":^)", ">:D", ":-D", ":D", "8-D", "x-D", "X-D", "=-D", "=D", "=-3", "8-)", ">:[", ":-(", ":(", ":-c", ":c", ":-<", ":-[", ":[", ":{", ">.>", "<.<", ">.<", ">;]", ";-)", ";)", "*-)", "*)", ";-]", ";]", ";D", ";^)", ">:P", ":-P", ":P", "X-P", "x-p", ":-p", ":p", "=p", ":-Þ", ":Þ", ":-b", ":b", "=p", "=P", ">:o", ">:O", ":-O", ":O", "°o°", "°O°", ":O", "o_O", "o.O", "8-0", ">:\\", ">:/", ":-/", ":-.", ":\\", "=/", "=\\", ":S", ":'(", ";'("];

$input = str_replace($smiles, '', $input);
$resultStr = '';
preg_match_all('/^\d\d:\d\d\s+<[%|\s|@|+][_a-zA-Z0-9]*>\s([^\r\n]*)/m', $input, $matches);
$resultStr = implode(' ', $matches[1]);
$resultStr = preg_replace('/[^\w\s*]+/', '', $resultStr);

preg_match_all('/<[%|\s|@|+][_a-zA-Z0-9]*>/m', $input, $nicks);
$nicks[0] = str_replace(['<', '>', ' ', '%', '+', '$', '@'], '', $nicks[0]);
$resultStr = str_replace($nicks[0], '', $resultStr);

Any suggestions to improve it will be appreciated 😉

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T20:59:57+00:00Added an answer on June 13, 2026 at 8:59 pm

    Something like this?

    preg_match_all('/^\d\d:\d\d\s+<[^>]*>([^\r\n]*)/m', $input, $matches);
    
    $resultStr = implode(' ', $matches[1]);
    $resultStr = preg_replace('/[^\w\s*]+/', '', $resultStr);
    

    First we match everything after hh:mm < name> until the end of the line. Then we join those results together with spaces, and then we remove all non-word, non-space, non-asterisk characters. Add other character you want to keep to the character class in the preg_replace.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
This could be a duplicate question, but I have no idea what search terms
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I have two tables with like below codes: Table: Accounts id | username |

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.