Skip to content

regex doesn't work #55

@PaulPuschmann

Description

@PaulPuschmann

I tried to start my first analysis....
panic: runtime error: index out of range [0] with length 0

image

I found the problem in extparser.go

in function parseFileLine() is a regex query

my variables look like this:
line: 2 drwxr-xr-x root root 1024 6-May-2020 18:31 .
e.fileinfoReg: ^\s*(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+-\w+-\d+)\s+(\d+:\d+)\s+([\S ]+)

Command: res := e.fileinfoReg.FindAllStringSubmatch(line, -1)
Result of the command: res = []

The next step is to try to access res:
size, _ := strconv.Atoi(res[0][5])
This query throws the error that you see in the main program

The question is: what is the goal of the regex query and how can I modify it to make it work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions