I'm trying to make a json file with all my countries cities and states (called departamentos here). I never found a complete list but now I'm following the list made by Wikipedia users in this link:
https://es.wikipedia.org/wiki/Anexo:Municipios_de_Colombia
I have copied and pasted all the text within a document, making a new line for each city like this:
Yacopí es una población y municipio del departamento de Cundinamarca
Currently I am able to select the city using RegEx with this expression:
/.+?(?= es)/
It takes everything from the beginning of the line to where it meets " es" for the first time, which is a regular convention for each of the lines in the Wikipedia page.
Now what I want to achieve is with the same line of Regex, also get the state which can be the last or last two words. Which I think it can be reached by selecting anything after " de ". But I'm stuck.
Any help would be appreciated and maybe other people around the world can start making json files out of Wikipedia.