Splitting a string based on locating a varying code (with a similar format)
问题 I uploaded a txt file in to R as follows: Election_Parties <- readr::read_lines("Election_Parties.txt") Let's say the following text was in the file: P23-Andalusian Social Democratic Party (Partido Social-Demócrata Andaluz [PSDA]) P24-Andalusian Socialist Movement (Movimiento Socialista Andaluz [MSA]) P235-Andalusian Socialist Party-Andalucian Party (Partido Socialista Andalucista-Partido Andalucista [PSA-PA]) P26-Andalusist Party (Partido Andalucista [PA]) P217-Andecha Astur (Andecha Astur