I want to ask for your help.
I have most of the data that looks like this:
a
b : c 901
d : e sda
v
w : x ads
any
abc : def 12132
ghi : jkl dasf
mno : pqr fas
stu : vwx utu
Description: the file starts with a line containing a single word (it can start with spaces, and spaces also after a word), then a line of attributes separated by a colon (also can have spaces), then again a line of attributes or a line with one word. I cannot create the correct regular expression to catch it in this form:
{
"a": [["b": "c 901"], ["d", "e sda"]],
"v": [["w", "x ads"]],
"any": ["abc", "def 12132"], ["ghi", "jkl dasf"],
}
Here is what I tried:
regex = str()
regex += "^(?:(?:\\s*)(.*?)(?:\\s*))$",
regex += "(?:(?:^(?:\\s*)(.*?)(?:\\s*):(?:\\s*)(.*?)(?:\\s*))$)*$"
pattern = re.compile(regex, re.S | re.M)
, . ? , , ":", , ( , , , -, ).
!
P.S. :
a
b : c 901
d : e sda
, ( ), ( ":" ), . . , .