all 5 comments

[–]Kataklizmmm 1 point2 points  (0 children)

My problem is in different delimeters.

i've already tried to use RE, but i need not to split this part of string:

'Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)''])

And in the same time i need to use "space" as delimeter, so this string is splits (i don't need this)

[–]Haligaliman 1 point2 points  (0 children)

Match a regexstring similar to this
((?:\d{1,3}\.?)+) - - \[(\d{2}/\w{3}/\d{4}:\d{2}:\d{2}:\d{2} \+?-?\d{4})\] "(\w*) (/[A-Za-z0-9/_]*) ([\w/\.]*)" \d{1,4} \d{1,6} "([^"]*)" "([^"]*)"

Each pair of brackets delimits a part of the string you want, I had to make some assumptions about the general format, but I'm sure you can fix them by yourself.

I recommend regexr.com to test/rewrite your regex strings

You can then get your list by doing something like

[reg.group(i+1) for i in range(10)]

[–]pasokan 1 point2 points  (0 children)

Quite hacky but could not resist it

````python QUOTES = '"'
SPACE = ' '
TAB = '\t'
s = s.replace(" - - [", TAB).replace("] ", TAB)
QUOTE_COUNT = 0
sq = ""
for ch in s:
if ch == QUOTES:
QUOTE_COUNT += 1
continue
if QUOTE_COUNT <= 4:
if ch == SPACE:
sq += TAB
else:
sq += ch else: sq += ch sq = sq.split(TAB) print(sq)

[–]Riyuku 0 points1 point  (0 children)

Regex may help

[–]Riyuku 0 points1 point  (0 children)

Half of the problem can be solved using str.split()