<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Optimising Regular expressions when using multiple arrays in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Optimising-Regular-expressions-when-using-multiple-arrays/m-p/324488#M72057</link>
    <description>&lt;P&gt;Morning World,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i am looking to optimise my code by reducing the statement&amp;nbsp;below by removing&amp;nbsp;the additional array match statement(&lt;FONT color="#ff0000"&gt;/* before city name street match*/&lt;/FONT&gt;), which i believe can be put into another (&lt;FONT color="#ff0000" face="Courier New"&gt;/* DETERMINE IF ITS A MATCH ON A STREET/ROAD/AVENUE NAME*/) &lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;so that it can all be done on the STREET MATCH variable rather than that and BEFORE MATCH&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The final result gives me what i need - identify an actual&amp;nbsp;city, identify when its actually a street (followed by STREET/ Road etc) and taking into consideration when the street name is before (RUE DE PARIS , Swaziland for example)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code works, but is much slower by adding in the regex before city name clause (worked fast on just city name street clause) - which i expect, but i want to obviously make this optimal. Also i expect more examples than rue de ... so i will need to build this in better also&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; rue = rue de;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CITY_FINAL&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;array&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; regex (&amp;amp;num_recs) $&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;200&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;_temporary_&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;array&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CITY_ARRAY (&amp;amp;num_recs) $&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;200&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;_temporary_&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;array&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; regex_before (&amp;amp;num_recs) $&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;200&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;_temporary_&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;* load cities names into list;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; _n_=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;then&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; p=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; to nobs;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CITIES &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;point&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=p &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;nobs&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=nobs;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;* Build REGEX for this "City_name with street/road/avenue";&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;regex(p)=cats(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"/\b("&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,City_name,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;")( st| ro| av)/i"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;); &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/* Build CITY_ARRAY for&amp;nbsp;"City_name" */&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;CITY_ARRAY(p)=City_name;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966" face="Courier New" size="3"&gt;/* Build array for instances where the street name is before the city name i.e rue de "City_name" .*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;FONT face="Courier New" size="3"&gt;regex_before(p)=cats(&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;"/\b(&amp;amp;rue )("&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,City_name,&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;")/i"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;); &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;* keep matches;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; test_data;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000" face="Courier New" size="3"&gt;/* DETERMINE IF ITS A MATCH ON A STREET/ROAD/AVENUE NAME*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;STREET_MATCH = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'N'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;found=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; i=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;to&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; nobs &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;until&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(found);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;found=prxmatch(regex(i),ADDRESS);&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; found &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;THEN&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;STREET_MATCH=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Y'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*ADD A MARKER TO IDENTIFY IF THERE IS A MATCH TO THE LISTED CITITES*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;CITY_MATCH = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'N'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*RUN THROUGH THE ARRAY*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; j=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;TO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; dim(CITY_array);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*CHECK AGAINST ADDRESS FIELDS FOR MATCH - IS THE CITY PART OF THE ADDRESS FIELD. USE UPPER CASE ON BOTH VARIABLES */&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;IF&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; indexw(upcase(ADDRESS), upcase(CITY_ARRAY[j])) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;THEN&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;CITY_MATCH=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Y'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;LEAVE&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;END&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;/* before city name street match*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;before_MATCH = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'N'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;found2=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; k=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;to&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; nobs &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;until&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(found2);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;found2=prxmatch(regex_before(k),ADDRESS);&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; found2 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;THEN&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;before_MATCH=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Y'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT color="#ff9900"&gt;TEST SAMPLES IF IT HELPS&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CITIES;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; City_name &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;$char20.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;KINGSLANDING&lt;/P&gt;&lt;P&gt;MORDOR&lt;/P&gt;&lt;P&gt;RIVENDELL&lt;/P&gt;&lt;P&gt;WINTERFELL&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; test_data;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ADDRESS &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;$char80.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;HAMBURG&lt;/P&gt;&lt;P&gt;KINGSLANDING&lt;/P&gt;&lt;P&gt;GENEVA&lt;/P&gt;&lt;P&gt;paris&lt;/P&gt;&lt;P&gt;birmingham&lt;/P&gt;&lt;P&gt;Zurich&lt;/P&gt;&lt;P&gt;SINGAPORE&lt;/P&gt;&lt;P&gt;MORDOR - CAN YOU STILL IDENTIFY ME?&lt;/P&gt;&lt;P&gt;RIVENDELL 01 STILL TESTING WTH ADD TXT&lt;/P&gt;&lt;P&gt;TEST MORDOR ST&lt;/P&gt;&lt;P&gt;247 WINTERFELL STREET&lt;/P&gt;&lt;P&gt;MORDOR st&lt;/P&gt;&lt;P&gt;sMORDOR st&lt;/P&gt;&lt;P&gt;MORRDOR road&lt;/P&gt;&lt;P&gt;rue de RIVENDELL&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Jan 2017 09:26:16 GMT</pubDate>
    <dc:creator>MR_E</dc:creator>
    <dc:date>2017-01-13T09:26:16Z</dc:date>
    <item>
      <title>Optimising Regular expressions when using multiple arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Optimising-Regular-expressions-when-using-multiple-arrays/m-p/324488#M72057</link>
      <description>&lt;P&gt;Morning World,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i am looking to optimise my code by reducing the statement&amp;nbsp;below by removing&amp;nbsp;the additional array match statement(&lt;FONT color="#ff0000"&gt;/* before city name street match*/&lt;/FONT&gt;), which i believe can be put into another (&lt;FONT color="#ff0000" face="Courier New"&gt;/* DETERMINE IF ITS A MATCH ON A STREET/ROAD/AVENUE NAME*/) &lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;so that it can all be done on the STREET MATCH variable rather than that and BEFORE MATCH&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The final result gives me what i need - identify an actual&amp;nbsp;city, identify when its actually a street (followed by STREET/ Road etc) and taking into consideration when the street name is before (RUE DE PARIS , Swaziland for example)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code works, but is much slower by adding in the regex before city name clause (worked fast on just city name street clause) - which i expect, but i want to obviously make this optimal. Also i expect more examples than rue de ... so i will need to build this in better also&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; rue = rue de;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CITY_FINAL&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;array&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; regex (&amp;amp;num_recs) $&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;200&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;_temporary_&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;array&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CITY_ARRAY (&amp;amp;num_recs) $&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;200&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;_temporary_&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;array&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; regex_before (&amp;amp;num_recs) $&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;200&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;_temporary_&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;* load cities names into list;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; _n_=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;then&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; p=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; to nobs;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CITIES &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;point&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=p &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;nobs&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=nobs;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;* Build REGEX for this "City_name with street/road/avenue";&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;regex(p)=cats(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"/\b("&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,City_name,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;")( st| ro| av)/i"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;); &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/* Build CITY_ARRAY for&amp;nbsp;"City_name" */&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;CITY_ARRAY(p)=City_name;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966" face="Courier New" size="3"&gt;/* Build array for instances where the street name is before the city name i.e rue de "City_name" .*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;FONT face="Courier New" size="3"&gt;regex_before(p)=cats(&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;"/\b(&amp;amp;rue )("&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,City_name,&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;")/i"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;); &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;* keep matches;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; test_data;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000" face="Courier New" size="3"&gt;/* DETERMINE IF ITS A MATCH ON A STREET/ROAD/AVENUE NAME*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;STREET_MATCH = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'N'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;found=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; i=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;to&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; nobs &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;until&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(found);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;found=prxmatch(regex(i),ADDRESS);&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; found &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;THEN&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;STREET_MATCH=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Y'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*ADD A MARKER TO IDENTIFY IF THERE IS A MATCH TO THE LISTED CITITES*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;CITY_MATCH = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'N'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*RUN THROUGH THE ARRAY*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; j=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;TO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; dim(CITY_array);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*CHECK AGAINST ADDRESS FIELDS FOR MATCH - IS THE CITY PART OF THE ADDRESS FIELD. USE UPPER CASE ON BOTH VARIABLES */&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;IF&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; indexw(upcase(ADDRESS), upcase(CITY_ARRAY[j])) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;THEN&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;CITY_MATCH=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Y'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;LEAVE&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;END&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;/* before city name street match*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;before_MATCH = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'N'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;found2=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; k=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;to&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; nobs &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;until&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(found2);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;found2=prxmatch(regex_before(k),ADDRESS);&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; found2 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;THEN&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;before_MATCH=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Y'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT color="#ff9900"&gt;TEST SAMPLES IF IT HELPS&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CITIES;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; City_name &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;$char20.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;KINGSLANDING&lt;/P&gt;&lt;P&gt;MORDOR&lt;/P&gt;&lt;P&gt;RIVENDELL&lt;/P&gt;&lt;P&gt;WINTERFELL&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; test_data;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ADDRESS &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;$char80.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;HAMBURG&lt;/P&gt;&lt;P&gt;KINGSLANDING&lt;/P&gt;&lt;P&gt;GENEVA&lt;/P&gt;&lt;P&gt;paris&lt;/P&gt;&lt;P&gt;birmingham&lt;/P&gt;&lt;P&gt;Zurich&lt;/P&gt;&lt;P&gt;SINGAPORE&lt;/P&gt;&lt;P&gt;MORDOR - CAN YOU STILL IDENTIFY ME?&lt;/P&gt;&lt;P&gt;RIVENDELL 01 STILL TESTING WTH ADD TXT&lt;/P&gt;&lt;P&gt;TEST MORDOR ST&lt;/P&gt;&lt;P&gt;247 WINTERFELL STREET&lt;/P&gt;&lt;P&gt;MORDOR st&lt;/P&gt;&lt;P&gt;sMORDOR st&lt;/P&gt;&lt;P&gt;MORRDOR road&lt;/P&gt;&lt;P&gt;rue de RIVENDELL&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2017 09:26:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Optimising-Regular-expressions-when-using-multiple-arrays/m-p/324488#M72057</guid>
      <dc:creator>MR_E</dc:creator>
      <dc:date>2017-01-13T09:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: Optimising Regular expressions when using multiple arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Optimising-Regular-expressions-when-using-multiple-arrays/m-p/324564#M72064</link>
      <description>&lt;P&gt;Here is an idea you can try,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Replace your Arrays with Hash Objects, and Hash Iterators &lt;A href="http://www.lexjansen.com/search/searchresults.php?q=hash%20Object" target="_self"&gt;http://www.lexjansen.com/search/searchresults.php?q=hash%20Object&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The Hash Object will provide you with functions to add(), and find(), and this will avoid/replace your Array Looping.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just a different programming approach, hope it helps,&lt;/P&gt;
&lt;P&gt;Ahmed&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2017 14:22:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Optimising-Regular-expressions-when-using-multiple-arrays/m-p/324564#M72064</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2017-01-13T14:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: Optimising Regular expressions when using multiple arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Optimising-Regular-expressions-when-using-multiple-arrays/m-p/324577#M72067</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;regex(p)=cats("/\b(&amp;amp;rue ",City_name,"|",City_name,"( st| ro| av))/i");</description>
      <pubDate>Fri, 13 Jan 2017 14:55:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Optimising-Regular-expressions-when-using-multiple-arrays/m-p/324577#M72067</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2017-01-13T14:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: Optimising Regular expressions when using multiple arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Optimising-Regular-expressions-when-using-multiple-arrays/m-p/324598#M72071</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/30622"&gt;@gamotte&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did actually come across this too, however it did not solve my issue as the Rue de Rivendell still is not identified:(attached results)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;performance wise it runs great, as it did without the before city name array and do loop before, but unfortunately did not identify Rue de&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/13328iC87BA8E6F739033B/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="rivendell.PNG" title="rivendell.PNG" /&gt;</description>
      <pubDate>Fri, 13 Jan 2017 15:28:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Optimising-Regular-expressions-when-using-multiple-arrays/m-p/324598#M72071</guid>
      <dc:creator>MR_E</dc:creator>
      <dc:date>2017-01-13T15:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: Optimising Regular expressions when using multiple arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Optimising-Regular-expressions-when-using-multiple-arrays/m-p/324604#M72073</link>
      <description>&lt;P&gt;this seems to work , but looks slight different - everything look ok from your POV? &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/30622"&gt;@gamotte&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;regex(p)=cats(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"/\b(&amp;amp;rue )("&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,City_name,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;")|\b("&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,City_name,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;")( st| ro| av)/i"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2017 16:01:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Optimising-Regular-expressions-when-using-multiple-arrays/m-p/324604#M72073</guid>
      <dc:creator>MR_E</dc:creator>
      <dc:date>2017-01-13T16:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: Optimising Regular expressions when using multiple arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Optimising-Regular-expressions-when-using-multiple-arrays/m-p/324618#M72079</link>
      <description>I have left work si I can not test but I suspect my answer does not work because of some blanks. Try to remove the leading blank in the définition of &amp;amp;rue.</description>
      <pubDate>Fri, 13 Jan 2017 16:13:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Optimising-Regular-expressions-when-using-multiple-arrays/m-p/324618#M72079</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2017-01-13T16:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: Optimising Regular expressions when using multiple arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Optimising-Regular-expressions-when-using-multiple-arrays/m-p/324996#M72224</link>
      <description>&lt;P&gt;The cats function removed the space after &amp;amp;rue. This should work :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;regex(p)=cats("/\b(&amp;amp;rue.\s",City_name,"|",City_name,"( st| ro| av))/i");&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2017 09:31:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Optimising-Regular-expressions-when-using-multiple-arrays/m-p/324996#M72224</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2017-01-16T09:31:46Z</dc:date>
    </item>
  </channel>
</rss>

