<?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 Re: Constraint or validation rule to check that text field matches a pattern? in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/constraint-or-validation-rule-to-check-that-text/m-p/1632127#M1810</link>
    <description>&lt;P&gt;Not an Arcade-based solution, but the Data Reviewer extension's &lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/validating-data/regular-expression.htm" target="_self"&gt;Regular Expression&lt;/A&gt; check can be used to create validation attribute rules to evaluate string formatting.&lt;/P&gt;</description>
    <pubDate>Thu, 10 Jul 2025 17:43:00 GMT</pubDate>
    <dc:creator>JayCary</dc:creator>
    <dc:date>2025-07-10T17:43:00Z</dc:date>
    <item>
      <title>Constraint or validation rule to check that text field matches a pattern?</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/constraint-or-validation-rule-to-check-that-text/m-p/1631390#M1805</link>
      <description>&lt;P&gt;Basically, I'd like to enforce a text field to follow a pattern like [A-Z]{4}\s{4}\d+, to use the regex for it. (Four letters followed by 4 whitespace chars, followed by 1 or more digits&lt;/P&gt;&lt;P&gt;Has anyone had any luck doing this?&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jul 2025 23:59:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/constraint-or-validation-rule-to-check-that-text/m-p/1631390#M1805</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2025-07-08T23:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint or validation rule to check that text field matches a pattern?</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/constraint-or-validation-rule-to-check-that-text/m-p/1631686#M1806</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/458875"&gt;@AlfredBaldenweck&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Give this a go. I used this as the testing value&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DDDD&lt;/SPAN&gt;&lt;SPAN&gt; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;1212121212&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;/*
Arcade Constraint Rule: Checks if a field matches the pattern:
- Four letters (A-Z, case-insensitive)
- Four whitespace characters
- One or more digits

Usage: Replace $feature.Name with your actual field name.
*/

var value = $feature.Name;

// Check if value is empty
if (IsEmpty(value)) {
    return false;
}

// Check length: at least 9 (4 letters + 4 spaces + 1 digit)
if (Count(value) &amp;lt; 9) {
    return false;
}

// Check first 4 are letters
for (var i = 0; i &amp;lt; 4; i++) {
    var ch = Mid(value, i, 1);
    if (Find(Upper(ch), "ABCDEFGHIJKLMNOPQRSTUVWXYZ") == -1) {
        return false;
    }
}

// Check next 4 are whitespace
for (var i = 4; i &amp;lt; 8; i++) {
    if (Mid(value, i, 1) != " ") {
        return false;
    }
}

// Check remaining are digits
for (var i = 8; i &amp;lt; Count(value); i++) {
    var ch = Mid(value, i, 1);
    if (Find(ch, "0123456789") == -1) {
        return false;
    }
}

return true;&lt;/LI-CODE&gt;&lt;P&gt;&lt;div class="lia-vid-container video-embed-center"&gt;&lt;div id="lia-vid-6375455304112w1062h540r144" class="lia-video-brightcove-player-container"&gt;&lt;video-js data-video-id="6375455304112" data-account="6161463677001" data-player="default" data-embed="default" class="vjs-fluid" controls="" data-application-id="" style="width: 100%; height: 100%;"&gt;&lt;/video-js&gt;&lt;/div&gt;&lt;script src="https://players.brightcove.net/6161463677001/default_default/index.min.js"&gt;&lt;/script&gt;&lt;script&gt;(function() {  var wrapper = document.getElementById('lia-vid-6375455304112w1062h540r144');  var videoEl = wrapper ? wrapper.querySelector('video-js') : null;  if (videoEl) {     if (window.videojs) {       window.videojs(videoEl).ready(function() {         this.on('loadedmetadata', function() {           this.el().querySelectorAll('.vjs-load-progress div[data-start]').forEach(function(bar) {             bar.setAttribute('role', 'presentation');             bar.setAttribute('aria-hidden', 'true');           });         });       });     }  }})();&lt;/script&gt;&lt;a class="video-embed-link" href="https://community.esri.com/t5/video/gallerypage/video-id/6375455304112"&gt;(view in My Videos)&lt;/a&gt;&lt;/div&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jul 2025 17:19:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/constraint-or-validation-rule-to-check-that-text/m-p/1631686#M1806</guid>
      <dc:creator>Jake_S</dc:creator>
      <dc:date>2025-07-09T17:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint or validation rule to check that text field matches a pattern?</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/constraint-or-validation-rule-to-check-that-text/m-p/1632127#M1810</link>
      <description>&lt;P&gt;Not an Arcade-based solution, but the Data Reviewer extension's &lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/validating-data/regular-expression.htm" target="_self"&gt;Regular Expression&lt;/A&gt; check can be used to create validation attribute rules to evaluate string formatting.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jul 2025 17:43:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/constraint-or-validation-rule-to-check-that-text/m-p/1632127#M1810</guid>
      <dc:creator>JayCary</dc:creator>
      <dc:date>2025-07-10T17:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint or validation rule to check that text field matches a pattern?</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/constraint-or-validation-rule-to-check-that-text/m-p/1632230#M1811</link>
      <description>&lt;P&gt;This worked pretty well, but is unfortunately more involved than I was hoping.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/163047"&gt;@JayCary&lt;/a&gt;&amp;nbsp;'s suggestion of using Data Reviewer also worked out ok, but has its own set of drawbacks.&lt;/P&gt;&lt;P&gt;Dropping this link to a relevant Idea&amp;nbsp;&lt;A href="https://community.esri.com/t5/developers-ideas/arcade-regular-expression-support/idi-p/1180076" target="_blank"&gt;Arcade: Regular Expression Support - Esri Community&lt;/A&gt;&amp;nbsp;to add regex to Arcade.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jul 2025 22:05:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/constraint-or-validation-rule-to-check-that-text/m-p/1632230#M1811</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2025-07-10T22:05:40Z</dc:date>
    </item>
  </channel>
</rss>

