Regular Expressions 101

Save & Share

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java 8
  • .NET 7.0 (C#)
  • Rust
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests

Tools

Sponsors
There are currently no sponsors. Become a sponsor today!
An explanation of your regex will be automatically generated as you type.
Detailed match information will be displayed here automatically.
  • All Tokens
  • Common Tokens
  • General Tokens
  • Anchors
  • Meta Sequences
  • Quantifiers
  • Group Constructs
  • Character Classes
  • Flags/Modifiers
  • Substitution
  • A single character of: a, b or c
    [abc]
  • A character except: a, b or c
    [^abc]
  • A character in the range: a-z
    [a-z]
  • A character not in the range: a-z
    [^a-z]
  • A character in the range: a-z or A-Z
    [a-zA-Z]
  • Any single character
    .
  • Alternate - match either a or b
    a|b
  • Any whitespace character
    \s
  • Any non-whitespace character
    \S
  • Any digit
    \d
  • Any non-digit
    \D
  • Any word character
    \w
  • Any non-word character
    \W
  • Match everything enclosed
    (?:...)
  • Capture everything enclosed
    (...)
  • Zero or one of a
    a?
  • Zero or more of a
    a*
  • One or more of a
    a+
  • Exactly 3 of a
    a{3}
  • 3 or more of a
    a{3,}
  • Between 3 and 6 of a
    a{3,6}
  • Start of string
    ^
  • End of string
    $
  • A word boundary
    \b
  • Non-word boundary
    \B

Regular Expression
No Match

/
/
g

Test String

Substitution

Processing...

Code Generator

Generated Code

import Foundation let pattern = #"<(result)\b[^>]*><type>(street_address)<\/type>(.*?)<\/\1>"# let regex = try! NSRegularExpression(pattern: pattern) let testString = #"<GeocodeResponse><status>OK</status><result><type>route</type><formatted_address>Weberstraße, 76133 Karlsruhe, Deutschland</formatted_address><address_component><long_name>Weberstraße</long_name><short_name>Weberstraße</short_name><type>route</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>Karlsruhe</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>76133</long_name><short_name>76133</short_name><type>postal_code</type></address_component><geometry><location><lat>49.0137969</lat><lng>8.3823197</lng></location><location_type>GEOMETRIC_CENTER</location_type><viewport><southwest><lat>49.0128180</lat><lng>8.3815239</lng></southwest><northeast><lat>49.0155159</lat><lng>8.3842218</lng></northeast></viewport><bounds><southwest><lat>49.0135327</lat><lng>8.3818684</lng></southwest><northeast><lat>49.0148012</lat><lng>8.3838773</lng></northeast></bounds></geometry><partial_match>true</partial_match></result><result><type>route</type><formatted_address>Weberstraße, 76275 Ettlingen, Deutschland</formatted_address><address_component><long_name>Weberstraße</long_name><short_name>Weberstraße</short_name><type>route</type></address_component><address_component><long_name>Ettlingen</long_name><short_name>Ettlingen</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>76275</long_name><short_name>76275</short_name><type>postal_code</type></address_component><geometry><location><lat>48.9157576</lat><lng>8.4353279</lng></location><location_type>GEOMETRIC_CENTER</location_type><viewport><southwest><lat>48.9133400</lat><lng>8.4319007</lng></southwest><northeast><lat>48.9175593</lat><lng>8.4364200</lng></northeast></viewport><bounds><southwest><lat>48.9133400</lat><lng>8.4319007</lng></southwest><northeast><lat>48.9175593</lat><lng>8.4364200</lng></northeast></bounds></geometry><partial_match>true</partial_match></result><result><type>route</type><formatted_address>Webergasse, 76646 Bruchsal, Deutschland</formatted_address><address_component><long_name>Webergasse</long_name><short_name>Webergasse</short_name><type>route</type></address_component><address_component><long_name>Bruchsal</long_name><short_name>Bruchsal</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>76646</long_name><short_name>76646</short_name><type>postal_code</type></address_component><geometry><location><lat>49.1008266</lat><lng>8.6460424</lng></location><location_type>GEOMETRIC_CENTER</location_type><viewport><southwest><lat>49.0994372</lat><lng>8.6447048</lng></southwest><northeast><lat>49.1021351</lat><lng>8.6474028</lng></northeast></viewport><bounds><southwest><lat>49.1004405</lat><lng>8.6459366</lng></southwest><northeast><lat>49.1011318</lat><lng>8.6461710</lng></northeast></bounds></geometry><partial_match>true</partial_match></result><result><type>route</type><formatted_address>Weberweg, 76676 Graben-Neudorf, Deutschland</formatted_address><address_component><long_name>Weberweg</long_name><short_name>Weberweg</short_name><type>route</type></address_component><address_component><long_name>Graben</long_name><short_name>Graben</short_name><type>sublocality</type><type>political</type></address_component><address_component><long_name>Graben-Neudorf</long_name><short_name>Graben-Neudorf</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>76676</long_name><short_name>76676</short_name><type>postal_code</type></address_component><geometry><location><lat>49.1526695</lat><lng>8.4796629</lng></location><location_type>GEOMETRIC_CENTER</location_type><viewport><southwest><lat>49.1510240</lat><lng>8.4778282</lng></southwest><northeast><lat>49.1537219</lat><lng>8.4805262</lng></northeast></viewport><bounds><southwest><lat>49.1520764</lat><lng>8.4786915</lng></southwest><northeast><lat>49.1526695</lat><lng>8.4796629</lng></northeast></bounds></geometry><partial_match>true</partial_match></result><result><type>route</type><formatted_address>Weberweg, 75045 Walzbachtal, Deutschland</formatted_address><address_component><long_name>Weberweg</long_name><short_name>Weberweg</short_name><type>route</type></address_component><address_component><long_name>Walzbachtal</long_name><short_name>Walzbachtal</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>75045</long_name><short_name>75045</short_name><type>postal_code</type></address_component><geometry><location><lat>49.0324282</lat><lng>8.5818896</lng></location><location_type>GEOMETRIC_CENTER</location_type><viewport><southwest><lat>49.0308596</lat><lng>8.5805560</lng></southwest><northeast><lat>49.0335575</lat><lng>8.5832540</lng></northeast></viewport><bounds><southwest><lat>49.0318771</lat><lng>8.5816400</lng></southwest><northeast><lat>49.0325400</lat><lng>8.5821700</lng></northeast></bounds></geometry><partial_match>true</partial_match></result><result><type>route</type><formatted_address>Weberstraße, 69181 Leimen, Deutschland</formatted_address><address_component><long_name>Weberstraße</long_name><short_name>Weberstraße</short_name><type>route</type></address_component><address_component><long_name>St. Ilgen</long_name><short_name>St. Ilgen</short_name><type>sublocality</type><type>political</type></address_component><address_component><long_name>Leimen</long_name><short_name>Leimen</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>69181</long_name><short_name>69181</short_name><type>postal_code</type></address_component><geometry><location><lat>49.3335061</lat><lng>8.6715011</lng></location><location_type>GEOMETRIC_CENTER</location_type><viewport><southwest><lat>49.3309796</lat><lng>8.6704410</lng></southwest><northeast><lat>49.3359619</lat><lng>8.6731390</lng></northeast></viewport><bounds><southwest><lat>49.3309796</lat><lng>8.6710000</lng></southwest><northeast><lat>49.3359619</lat><lng>8.6725800</lng></northeast></bounds></geometry><partial_match>true</partial_match></result><result><type>point_of_interest</type><type>establishment</type><formatted_address>Fahrschule Weber Gmbh, Königsberger Straße 2i, 76139 Karlsruhe, Deutschland</formatted_address><address_component><long_name>Fahrschule Weber Gmbh</long_name><short_name>Fahrschule Weber Gmbh</short_name><type>point_of_interest</type><type>establishment</type></address_component><address_component><long_name>2i</long_name><short_name>2i</short_name><type>street_number</type></address_component><address_component><long_name>Königsberger Straße</long_name><short_name>Königsberger Straße</short_name><type>route</type></address_component><address_component><long_name>Waldstadt</long_name><short_name>Waldstadt</short_name><type>sublocality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>Karlsruhe</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>76139</long_name><short_name>76139</short_name><type>postal_code</type></address_component><geometry><location><lat>49.0332600</lat><lng>8.4335900</lng></location><location_type>APPROXIMATE</location_type><viewport><southwest><lat>49.0319110</lat><lng>8.4322410</lng></southwest><northeast><lat>49.0346090</lat><lng>8.4349390</lng></northeast></viewport></geometry><partial_match>true</partial_match></result><result><type>point_of_interest</type><type>establishment</type><formatted_address>Fahrschule Weber GmbH, Rudolf-Breitscheid-Straße 6, 76189 Karlsruhe, Deutschland</formatted_address><address_component><long_name>Fahrschule Weber GmbH</long_name><short_name>Fahrschule Weber GmbH</short_name><type>point_of_interest</type><type>establishment</type></address_component><address_component><long_name>6</long_name><short_name>6</short_name><type>street_number</type></address_component><address_component><long_name>Rudolf-Breitscheid-Straße</long_name><short_name>Rudolf-Breitscheid-Straße</short_name><type>route</type></address_component><address_component><long_name>Oberreut</long_name><short_name>Oberreut</short_name><type>sublocality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>Karlsruhe</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>76189</long_name><short_name>76189</short_name><type>postal_code</type></address_component><geometry><location><lat>48.9880500</lat><lng>8.3606000</lng></location><location_type>APPROXIMATE</location_type><viewport><southwest><lat>48.9867010</lat><lng>8.3592510</lng></southwest><northeast><lat>48.9893990</lat><lng>8.3619490</lng></northeast></viewport></geometry><partial_match>true</partial_match></result><result><type>route</type><formatted_address>Weberstraße, 69469 Weinheim, Deutschland</formatted_address><address_component><long_name>Weberstraße</long_name><short_name>Weberstraße</short_name><type>route</type></address_component><address_component><long_name>Weinheim</long_name><short_name>Weinheim</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>69469</long_name><short_name>69469</short_name><type>postal_code</type></address_component><geometry><location><lat>49.5400734</lat><lng>8.6631614</lng></location><location_type>GEOMETRIC_CENTER</location_type><viewport><southwest><lat>49.5382697</lat><lng>8.6621384</lng></southwest><northeast><lat>49.5420413</lat><lng>8.6648363</lng></northeast></viewport><bounds><southwest><lat>49.5382697</lat><lng>8.6628747</lng></southwest><northeast><lat>49.5420413</lat><lng>8.6641000</lng></northeast></bounds></geometry><partial_match>true</partial_match></result><result><type>route</type><formatted_address>Weberstraße, 72160 Horb am Neckar, Deutschland</formatted_address><address_component><long_name>Weberstraße</long_name><short_name>Weberstraße</short_name><type>route</type></address_component><address_component><long_name>Horb am Neckar</long_name><short_name>Horb am Neckar</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>72160</long_name><short_name>72160</short_name><type>postal_code</type></address_component><geometry><location><lat>48.4566083</lat><lng>8.6960277</lng></location><location_type>GEOMETRIC_CENTER</location_type><viewport><southwest><lat>48.4550282</lat><lng>8.6936341</lng></southwest><northeast><lat>48.4577261</lat><lng>8.6978700</lng></northeast></viewport><bounds><southwest><lat>48.4556943</lat><lng>8.6936341</lng></southwest><northeast><lat>48.4570600</lat><lng>8.6978700</lng></northeast></bounds></geometry><partial_match>true</partial_match></result><result><type>route</type><formatted_address>Weberstraße, 68165 Mannheim, Deutschland</formatted_address><address_component><long_name>Weberstraße</long_name><short_name>Weberstraße</short_name><type>route</type></address_component><address_component><long_name>Mannheim</long_name><short_name>MA</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>68165</long_name><short_name>68165</short_name><type>postal_code</type></address_component><geometry><location><lat>49.4770459</lat><lng>8.4859892</lng></location><location_type>GEOMETRIC_CENTER</location_type><viewport><southwest><lat>49.4757336</lat><lng>8.4845894</lng></southwest><northeast><lat>49.4784315</lat><lng>8.4872874</lng></northeast></viewport><bounds><southwest><lat>49.4764387</lat><lng>8.4856658</lng></southwest><northeast><lat>49.4777264</lat><lng>8.4862110</lng></northeast></bounds></geometry><partial_match>true</partial_match></result><result><type>route</type><formatted_address>Weberstraße, 77815 Bühl, Deutschland</formatted_address><address_component><long_name>Weberstraße</long_name><short_name>Weberstraße</short_name><type>route</type></address_component><address_component><long_name>Bühl</long_name><short_name>Bühl</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>77815</long_name><short_name>77815</short_name><type>postal_code</type></address_component><geometry><location><lat>48.7119980</lat><lng>8.0892535</lng></location><location_type>GEOMETRIC_CENTER</location_type><viewport><southwest><lat>48.7105510</lat><lng>8.0882389</lng></southwest><northeast><lat>48.7132489</lat><lng>8.0909368</lng></northeast></viewport><bounds><southwest><lat>48.7114184</lat><lng>8.0889882</lng></southwest><northeast><lat>48.7123815</lat><lng>8.0901875</lng></northeast></bounds></geometry><partial_match>true</partial_match></result><result><type>route</type><formatted_address>Weberstraße, 69120 Heidelberg, Deutschland</formatted_address><address_component><long_name>Weberstraße</long_name><short_name>Weberstraße</short_name><type>route</type></address_component><address_component><long_name>Neuenheim-Mitte</long_name><short_name>Neuenheim-Mitte</short_name><type>sublocality</type><type>political</type></address_component><address_component><long_name>Heidelberg</long_name><short_name>Heidelberg</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>69120</long_name><short_name>69120</short_name><type>postal_code</type></address_component><geometry><location><lat>49.4186483</lat><lng>8.6889792</lng></location><location_type>GEOMETRIC_CENTER</location_type><viewport><southwest><lat>49.4172660</lat><lng>8.6874800</lng></southwest><northeast><lat>49.4199640</lat><lng>8.6902100</lng></northeast></viewport><bounds><southwest><lat>49.4183100</lat><lng>8.6874800</lng></southwest><northeast><lat>49.4189200</lat><lng>8.6902100</lng></northeast></bounds></geometry><partial_match>true</partial_match></result><result><type>route</type><formatted_address>Weberstraße, 69226 Nußloch, Deutschland</formatted_address><address_component><long_name>Weberstraße</long_name><short_name>Weberstraße</short_name><type>route</type></address_component><address_component><long_name>Nußloch</long_name><short_name>Nußloch</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>69226</long_name><short_name>69226</short_name><type>postal_code</type></address_component><geometry><location><lat>49.3267142</lat><lng>8.6882816</lng></location><location_type>GEOMETRIC_CENTER</location_type><viewport><southwest><lat>49.3255859</lat><lng>8.6861069</lng></southwest><northeast><lat>49.3282838</lat><lng>8.6888048</lng></northeast></viewport><bounds><southwest><lat>49.3266617</lat><lng>8.6861390</lng></southwest><northeast><lat>49.3272080</lat><lng>8.6887727</lng></northeast></bounds></geometry><partial_match>true</partial_match></result><result><type>route</type><formatted_address>Weberstraße, 75239 Eisingen, Deutschland</formatted_address><address_component><long_name>Weberstraße</long_name><short_name>Weberstraße</short_name><type>route</type></address_component><address_component><long_name>Eisingen</long_name><short_name>Eisingen</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>75239</long_name><short_name>75239</short_name><type>postal_code</type></address_component><geometry><location><lat>48.9426959</lat><lng>8.6721686</lng></location><location_type>GEOMETRIC_CENTER</location_type><viewport><southwest><lat>48.9386471</lat><lng>8.6679742</lng></southwest><northeast><lat>48.9460369</lat><lng>8.6757700</lng></northeast></viewport><bounds><southwest><lat>48.9386471</lat><lng>8.6679742</lng></southwest><northeast><lat>48.9460369</lat><lng>8.6757700</lng></northeast></bounds></geometry><partial_match>true</partial_match></result><result><type>route</type><formatted_address>Weberstraße, 76473 Iffezheim, Deutschland</formatted_address><address_component><long_name>Weberstraße</long_name><short_name>Weberstraße</short_name><type>route</type></address_component><address_component><long_name>Iffezheim</long_name><short_name>Iffezheim</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>76473</long_name><short_name>76473</short_name><type>postal_code</type></address_component><geometry><location><lat>48.8226169</lat><lng>8.1386062</lng></location><location_type>GEOMETRIC_CENTER</location_type><viewport><southwest><lat>48.8212809</lat><lng>8.1373057</lng></southwest><northeast><lat>48.8239788</lat><lng>8.1400037</lng></northeast></viewport><bounds><southwest><lat>48.8220395</lat><lng>8.1383939</lng></southwest><northeast><lat>48.8232202</lat><lng>8.1389155</lng></northeast></bounds></geometry><partial_match>true</partial_match></result><result><type>doctor</type><type>point_of_interest</type><type>health</type><type>establishment</type><formatted_address>Dr. H. Matthias Weber, Lohengrinstraße 4A, 76185 Karlsruhe, Deutschland</formatted_address><address_component><long_name>Dr. H. Matthias Weber</long_name><short_name>Dr. H. Matthias Weber</short_name><type>point_of_interest</type><type>establishment</type></address_component><address_component><long_name>4A</long_name><short_name>4A</short_name><type>street_number</type></address_component><address_component><long_name>Lohengrinstraße</long_name><short_name>Lohengrinstraße</short_name><type>route</type></address_component><address_component><long_name>Mühlburg</long_name><short_name>Mühlburg</short_name><type>sublocality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>Karlsruhe</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>76185</long_name><short_name>76185</short_name><type>postal_code</type></address_component><geometry><location><lat>49.0160995</lat><lng>8.3640586</lng></location><location_type>APPROXIMATE</location_type><viewport><southwest><lat>49.0147505</lat><lng>8.3627096</lng></southwest><northeast><lat>49.0174485</lat><lng>8.3654076</lng></northeast></viewport></geometry><partial_match>true</partial_match></result><result><type>doctor</type><type>point_of_interest</type><type>health</type><type>establishment</type><formatted_address>Abegg F. Dr. med., Bässler-Weber S. Dr. med., Lameystraße 7, 76185 Karlsruhe, Deutschland</formatted_address><address_component><long_name>Abegg F. Dr. med., Bässler-Weber S. Dr. med.</long_name><short_name>Abegg F. Dr. med., Bässler-Weber S. Dr. med.</short_name><type>point_of_interest</type><type>establishment</type></address_component><address_component><long_name>7</long_name><short_name>7</short_name><type>street_number</type></address_component><address_component><long_name>Lameystraße</long_name><short_name>Lameystraße</short_name><type>route</type></address_component><address_component><long_name>Mühlburg</long_name><short_name>Mühlburg</short_name><type>sublocality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>Karlsruhe</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>Karlsruhe</short_name><type>administrative_area_level_3</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>76185</long_name><short_name>76185</short_name><type>postal_code</type></address_component><geometry><location><lat>49.0109105</lat><lng>8.3576554</lng></location><location_type>APPROXIMATE</location_type><viewport><southwest><lat>49.0095615</lat><lng>8.3563064</lng></southwest><northeast><lat>49.0122595</lat><lng>8.3590044</lng></northeast></viewport></geometry><partial_match>true</partial_match></result><result><type>point_of_interest</type><type>establishment</type><formatted_address>Herzog & Weber - Sachverständigenbüro, Arndtstraße 14, 76199 Karlsruhe, Deutschland</formatted_address><address_component><long_name>Herzog & Weber - Sachverständigenbüro</long_name><short_name>Herzog & Weber - Sachverständigenbüro</short_name><type>point_of_interest</type><type>establishment</type></address_component><address_component><long_name>14</long_name><short_name>14</short_name><type>street_number</type></address_component><address_component><long_name>Arndtstraße</long_name><short_name>Arndtstraße</short_name><type>route</type></address_component><address_component><long_name>Rüppurr</long_name><short_name>Rüppurr</short_name><type>sublocality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>Karlsruhe</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>Karlsruhe</short_name><type>administrative_area_level_3</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>76199</long_name><short_name>76199</short_name><type>postal_code</type></address_component><geometry><location><lat>48.9674695</lat><lng>8.4050280</lng></location><location_type>APPROXIMATE</location_type><viewport><southwest><lat>48.9661205</lat><lng>8.4036790</lng></southwest><northeast><lat>48.9688185</lat><lng>8.4063770</lng></northeast></viewport></geometry><partial_match>true</partial_match></result><result><type>point_of_interest</type><type>establishment</type><formatted_address>Fahrschule Weber GmbH, Saarlandstraße 101, 76187 Karlsruhe, Deutschland</formatted_address><address_component><long_name>Fahrschule Weber GmbH</long_name><short_name>Fahrschule Weber GmbH</short_name><type>point_of_interest</type><type>establishment</type></address_component><address_component><long_name>101</long_name><short_name>101</short_name><type>street_number</type></address_component><address_component><long_name>Saarlandstraße</long_name><short_name>Saarlandstraße</short_name><type>route</type></address_component><address_component><long_name>Knielingen</long_name><short_name>Knielingen</short_name><type>sublocality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>Karlsruhe</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>Karlsruhe</short_name><type>administrative_area_level_3</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>76187</long_name><short_name>76187</short_name><type>postal_code</type></address_component><geometry><location><lat>49.0293780</lat><lng>8.3414936</lng></location><location_type>APPROXIMATE</location_type><viewport><southwest><lat>49.0280290</lat><lng>8.3401446</lng></southwest><northeast><lat>49.0307270</lat><lng>8.3428426</lng></northeast></viewport></geometry><partial_match>true</partial_match></result><result><type>route</type><formatted_address>Weberweg, 75385 Bad Teinach-Zavelstein, Deutschland</formatted_address><address_component><long_name>Weberweg</long_name><short_name>Weberweg</short_name><type>route</type></address_component><address_component><long_name>Bad Teinach-Zavelstein</long_name><short_name>Bad Teinach-Zavelstein</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>75385</long_name><short_name>75385</short_name><type>postal_code</type></address_component><geometry><location><lat>48.6942730</lat><lng>8.6915589</lng></location><location_type>GEOMETRIC_CENTER</location_type><viewport><southwest><lat>48.6929822</lat><lng>8.6900461</lng></southwest><northeast><lat>48.6956801</lat><lng>8.6927440</lng></northeast></viewport><bounds><southwest><lat>48.6942123</lat><lng>8.6905665</lng></southwest><northeast><lat>48.6944500</lat><lng>8.6922236</lng></northeast></bounds></geometry><partial_match>true</partial_match></result><result><type>route</type><formatted_address>Weberweg, 75417 Mühlacker, Deutschland</formatted_address><address_component><long_name>Weberweg</long_name><short_name>Weberweg</short_name><type>route</type></address_component><address_component><long_name>Enzberg</long_name><short_name>Enzberg</short_name><type>sublocality</type><type>political</type></address_component><address_component><long_name>Mühlacker</long_name><short_name>Mühlacker</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>75417</long_name><short_name>75417</short_name><type>postal_code</type></address_component><geometry><location><lat>48.9381987</lat><lng>8.7961320</lng></location><location_type>GEOMETRIC_CENTER</location_type><viewport><southwest><lat>48.9369100</lat><lng>8.7951701</lng></southwest><northeast><lat>48.9396079</lat><lng>8.7978681</lng></northeast></viewport><bounds><southwest><lat>48.9380752</lat><lng>8.7957519</lng></southwest><northeast><lat>48.9384427</lat><lng>8.7972863</lng></northeast></bounds></geometry><partial_match>true</partial_match></result><result><type>route</type><formatted_address>Webergasse, 76479 Steinmauern, Deutschland</formatted_address><address_component><long_name>Webergasse</long_name><short_name>Webergasse</short_name><type>route</type></address_component><address_component><long_name>Steinmauern</long_name><short_name>Steinmauern</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>76479</long_name><short_name>76479</short_name><type>postal_code</type></address_component><geometry><location><lat>48.8971392</lat><lng>8.1921222</lng></location><location_type>GEOMETRIC_CENTER</location_type><viewport><southwest><lat>48.8958283</lat><lng>8.1908745</lng></southwest><northeast><lat>48.8985263</lat><lng>8.1935725</lng></northeast></viewport><bounds><southwest><lat>48.8968715</lat><lng>8.1918182</lng></southwest><northeast><lat>48.8974831</lat><lng>8.1926288</lng></northeast></bounds></geometry><partial_match>true</partial_match></result><result><type>route</type><formatted_address>Weberstraße, 68775 Ketsch, Deutschland</formatted_address><address_component><long_name>Weberstraße</long_name><short_name>Weberstraße</short_name><type>route</type></address_component><address_component><long_name>Ketsch</long_name><short_name>Ketsch</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>68775</long_name><short_name>68775</short_name><type>postal_code</type></address_component><geometry><location><lat>49.3590621</lat><lng>8.5337213</lng></location><location_type>GEOMETRIC_CENTER</location_type><viewport><southwest><lat>49.3578611</lat><lng>8.5323289</lng></southwest><northeast><lat>49.3605591</lat><lng>8.5350268</lng></northeast></viewport><bounds><southwest><lat>49.3588900</lat><lng>8.5331957</lng></southwest><northeast><lat>49.3595302</lat><lng>8.5341600</lng></northeast></bounds></geometry><partial_match>true</partial_match></result><result><type>route</type><formatted_address>Webergasse, 75236 Kämpfelbach, Deutschland</formatted_address><address_component><long_name>Webergasse</long_name><short_name>Webergasse</short_name><type>route</type></address_component><address_component><long_name>Ersingen</long_name><short_name>Ersingen</short_name><type>sublocality</type><type>political</type></address_component><address_component><long_name>Kämpfelbach</long_name><short_name>Kämpfelbach</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Enzkreis</long_name><short_name>Enzkreis</short_name><type>administrative_area_level_3</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>75236</long_name><short_name>75236</short_name><type>postal_code</type></address_component><geometry><location><lat>48.9337280</lat><lng>8.6348601</lng></location><location_type>GEOMETRIC_CENTER</location_type><viewport><southwest><lat>48.9323410</lat><lng>8.6335423</lng></southwest><northeast><lat>48.9350390</lat><lng>8.6362402</lng></northeast></viewport><bounds><southwest><lat>48.9335600</lat><lng>8.6347613</lng></southwest><northeast><lat>48.9338200</lat><lng>8.6350212</lng></northeast></bounds></geometry><partial_match>true</partial_match></result><result><type>route</type><formatted_address>Adolf-Weber-Straße, 74864 Fahrenbach, Deutschland</formatted_address><address_component><long_name>Adolf-Weber-Straße</long_name><short_name>Adolf-Weber-Straße</short_name><type>route</type></address_component><address_component><long_name>Fahrenbach</long_name><short_name>Fahrenbach</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Karlsruhe</long_name><short_name>KA</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Baden-Württemberg</long_name><short_name>BW</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Deutschland</long_name><short_name>DE</short_name><type>country</type><type>political</type></address_component><address_component><long_name>74864</long_name><short_name>74864</short_name><type>postal_code</type></address_component><geometry><location><lat>49.4301926</lat><lng>9.1441832</lng></location><location_type>GEOMETRIC_CENTER</location_type><viewport><southwest><lat>49.4293366</lat><lng>9.1387460</lng></southwest><northeast><lat>49.4320345</lat><lng>9.1498849</lng></northeast></viewport><bounds><southwest><lat>49.4295000</lat><lng>9.1387460</lng></southwest><northeast><lat>49.4318711</lat><lng>9.1498849</lng></northeast></bounds></geometry><partial_match>true</partial_match></result></GeocodeResponse>"# let stringRange = NSRange(location: 0, length: testString.utf16.count) let substitutionString = #""# let result = regex.stringByReplacingMatches(in: testString, range: stringRange, withTemplate: substitutionString) print(result)

Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Swift 5.2, please visit: https://developer.apple.com/documentation/foundation/nsregularexpression