REGEX - deny prepositions in the name of public places

1

I'm needing help with a regex. I need to hit sites at the base of the Post Office, but because of the prepositions many places are not found.

Example:

ARMACAO STREET STREET STREET STREET

Mailbox = STREET BEACH FROM ARMACAO

Outbound file = Public address not found

I need a regex that ignores prepositions and looks for everything before and after it.

I got the expression that returns the prepositions (\ sDE \ sDA \ sDA \ sDO \ s).

ButwhenIputthenegation(?!\sDE\sDA\sDA\sDO\sDO\s),itreturnsnothing.

Do not need to be anything for a specific language, working in text editor is already Ok for what I need. The search of the place will be done by StringReplacer of the FME (image below).

    
asked by anonymous 22.03.2018 / 15:55

1 answer

0

Assuming that each address only has a preposition and we only look for the prepositions "DE", "DA" and "DO", we can simplify the comparisons using the expression:

 /^(.*?)((?:\sD[AEO])(\s.*))?$/
The consequence is that if there is a proposition, by capturing the relevant parts - group 1 and group 3 (if it exists), they would not be in the same group but if, in code, a new string is created as the concatenation of the two groups, the comparison can be made.

    
22.03.2018 / 17:40