Reputation: 23
I've been trying to replace (and translate) this text, and i don't know what formula I should Use for thousands of places that I need to translate to Spanish. OKay this is what i want to do, i want to use regular expressions on Notepadd++.
I give 4 variations, and in bold is what's supposed to go after the name of the place, in lower case and not to be confused with eg. Agency Village because that's its name.
Missouri 5,988,927
Adrian City city 1,677
Advance city 1,347
Affton CDP 20,307
Agency Village village 684
Airport Drive village 698
To
| [[Adrian City (Misuri)|Adrian City]] || ciudad || 1677
|-
| [[Advance (Misuri)|Advance]] || ciudad || 1347
|-
| [[Afton (Misuri)|Afton]] || CDP || 20307
|-
| [[Agency Village (Misuri)|Agency Village]] || villa || 684
|-
| [[Airport Drive (Misuri)|Airport Drive]] || villa || 698
Upvotes: 2
Views: 898
Reputation: 93046
I think there is no way to get the Missouri from the first line into every following line with Notepad. In Notepad the regular expressions are limited to one row. There for you would need a scripting language like Perl.
Then you will need for every keyword a separate regular expression. For "city" it would be:
(.*)\scity\s(.*)
should be replaced with
| [[\1 (Misuri)|\1]] || ciudad || \2
The expression between the () are stored into variables and can be recalled with \1, \2, ... for the first, second, ... occurrence of brackets.
Take care if you have cases like
Adrian City village 1,677
you have to activate "Match case" and you need to rely on the upper/lower case distinction.
To remove the commas from the numbers:
(\d*),(\d*)
\1\2
Upvotes: 2