Jump to content

Recommended Posts

Hi guys, new around here, been working with PHP/SQL for a couple of years.

 

Recently I started working on a PHP parser for a game I play. Unfortunately, I've found that some of the expressions I use to obtain data from the game logs do not work on all the logs. Some logs display data incorrectly or have added on data that confuses the parser.

 

I've tried just about everything here. I'm trying to see if there's a way I can start the parsing process at a particular spot in the log. To be specific, here are some parts of the log and the problem I'm running into:

 

  summonerName = "xxxxxxxxx"
            teamId = 200
            userId = xxxxxxxxxx

 

This part of the log is what I am interested in. I need an expression that will dig up 'teamId' only when it's preceded by a summonerName value.

 

/teamId = (.*)'/

 

That regex works fine on smaller log files, where there are 10 teamId values(and there are 10 players). However, on larger log files, there are additional clutter occurrences

of 'teamId' and it causes the parser to place all 10 people in the same team, or completely mess everything up. This is what larger log files display:

 

    source = (Array)#28
  teamId = 200

 

Because there are more teamId values than actual people in these game logs, the parser breaks and becomes unreliable.

 

In short, I need either one of two things:

1. I need a regular expression that will check for 'teamId' when preceded by a summonerName value only(and checks for this across lines)(?<=\") didn't work(to check for the quote that precedes teamId when summonerName is above it).

2. I need a regular expression that will check for all the values I'm digging up starting at a certain point in the log file. Using offsets to cut up lines is not efficient, because sometimes the values can be found on line 5,000 and sometimes the values can be found on line 14,000. The value I want to use is starting on this part of the log:

    gameState = "TERMINATED"

 

If you need me to clarify anything, please let me know. I know I confused myself even more just trying to write about what it is I want done here, but I'd really like to see if I can solve this problem. I need regular expressions that will work on every kind of log in the game, and right now it just works on the smaller ones(800kb or less).

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.