Regular expression

Hi,

I have the following list:

[1] "Name:  [00:00:01] My name is Antonio Margareeete."

[2] "Name2: [00:00:10] Can you repeat please?"

[3] "Name :  [00:00:14]  Margareeeeeete."

I would like to split this in three pieces, such as:

     x1         x2                                           x3 
Name       00:00:01    "My name is Antonio Margareeete."
Name2      00:00:10      "Can you repeat please?"
Name      00:00:14         " Margareeeeeete."

I would appreciate some advice.

Thanks

Hi, you can split using brackets (supposing that the text will not include them), then bind the results and convert it to dataframe using:

as.data.frame(do.call(rbind, strsplit(mylist,"\\[|\\]")))

and later you can clean the first column by removing the dots.

1 Like

Amazing. Thanks very much for this!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.