Regex to check a string

0

I'm having trouble creating a regex, I'd like it to identify SP or sp or São paulo , then any other words and again check if it has, outro or Minas gerais (other states), in this sequence, example I already mounted:

(sp|SP|sao paulo|são paulo|São paulo)+.*(outro|mg|MG|pr|PR|Acre|ac|AC|Alagoas|AL|al|Amapa|APap|Amazonas|AM|am|Bahia|BA|ba|Ceará|ce|CE|Distrito Federal|DF|df|Espírito Santo|es|ES|Goias|GO|go|Maranhão|MA|ma|Mato Grosso|MT|mt|Mato Grosso do Sul|MS|ms|Minas Gerais|MG|mg|Pará|PA|pa|Paraiba|PB|pb|Parana|PR|pr|Pernambuco|PE|pe|Piaui|PI|pi|Rio de Janeiro|RJ|rj|Rio Grande do Norte|RN|rn|Rio Grande do Sul|RS|rs|Rondônia|RO|ro|Roraima|RR|rr|Santa Catarina|SC|sc|Sergipe|SE|se|Tocantins|TO|to)+

But .* ends up validating this, and it's not what I want.

Test example

  

from sao paulo to another state
  of sp for mines general
  from São Paulo to mg

    
asked by anonymous 24.11.2017 / 12:16

0 answers