Jump to content

odonel

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

odonel's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Josh's solution is perfect jazz, I will work on the second part of getting the arrays into the mysql tables. Thank you
  2. Thanx jazz, with your help, I added 2 patterns, but could not get the IP address by itself $string="Wed Jul 04 08:23:55 EDT 2012, johndoe(192.168.0.190) to all: testeeeeeeeeeeeeeeeeettttttttttttttttttttt"; $patterns = array(); $patterns[0] = '/\,/'; $patterns[1] = '/(\(.*\))/'; $patterns[2] = '/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/'; $patterns[3] = '/(?<=all)\:/'; $replacements = array(); $replacements[0] = '!~'; $replacements[1] = '!~'; $replacements[2] = '!~'; $replacements[3] = '!~'; echo preg_replace($patterns, $replacements, $string);
  3. Hello I have a text file with many lines of text in this format. Wed Jul 04 08:23:55 EDT 2012, johndoe(192.168.0.190) to all: testeeeeeeeeeeeeeeeeettttttttttttttttttttt I'd like to break them like this (date|~|username|~|message) so that I can insert each line in mysql the delimiter I want to add is |~| This is my first attempt to break the strings first, but got lost in the regex $string1="Wed Jul 04 08:23:55 EDT 2012, johndoe(192.168.0.190) to all: testeeeeeeeeeeeeeeeeettttttttttttttttttttt"; preg_match_all('/(\w{3}\s\w{3}\s\d{2}\s\d{2}:\d{2}:\d{2}\s\w{3}\s\d{4},)|(\w{1,15}.*\()-/', $string1, $match, PREG_PATTERN_ORDER);
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.