Developer | what3words
We use cookies, including third party cookies, to improve your experience and for marketing purposes. By continuing to browse we assume you have consented to their use.Learn more
got it
All tutorials

Detecting if text is in the format of a 3 word address using RegEx


It is often useful to know if a text string (like “filled.count.soap”) looks like a 3 word address, without having to ask the API. To make life easier for developers, we provide the RegEx below for different programming languages. You can use them to identify strings that could be 3 word addresses.

We present two regular expressions for each language. One for an exact match, used for determining if a given text sample is exactly in the form of a 3 word address, and the other is for searching for 3 word addresses in sentences or paragraphs. The difference is the begin and end characters in the RegEx.

Regular expressions are provided for JavaScript, Java, Python, Swift, Objective-C and PHP.

Related tutorials

Back to top