0
I’m having trouble creating a regex, I’d like him to identify SP
or sp
or São paulo
, then any other words and again check if you have, outro
or Minas gerais
(other states), in this sequence, example that I’ve assembled :
(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 the .*
ends up validating this, and it’s not what I want.
Test example
from Sao Paulo to another state
from sp to minas gerais
from São Paulo to mg
Try to change the
.*
for.*?
– Ailton Andrade de Oliveira
You can give input examples along with what you want to capture in each?
– Woss
The first part house "spSPsao paulo", that’s right?
– Jefferson Quesado
that check if he typed something related to sao paulo, so I put the variations, already put the . *? , but it does not work 100%
– ALE_ROM
example input: de sao paulo to another state; de sp to minas gerais; de São Paulo to mg
– ALE_ROM
Can you play on https://regex101.com/ these examples? Include the ones that aren’t working too.
– Woss
I was testing it anyway, I made some adjustments and at first it’s working, thanks for the help
– ALE_ROM