# Locator with date in it - dynamic

**URL:** <https://discuss.appium.io/t/locator-with-date-in-it-dynamic/38468>\
**Category:** Support\
**Created:** [February 7, 2023, 4:22am UTC](https://discuss.appium.io/t/locator-with-date-in-it-dynamic/38468 "2023-02-07T04:22:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elvin\_Danyarov](https://discuss.appium.io/user_avatar/discuss.appium.io/elvin_danyarov/32/10355_2.png) [@Elvin\_Danyarov](https://discuss.appium.io/u/Elvin_Danyarov)\
**Post date:** [February 7, 2023, 4:22am UTC](https://discuss.appium.io/t/locator-with-date-in-it-dynamic/38468/1 "2023-02-07T04:22:13Z")

</div>

Hi folks,

how would you handle the below locator:  
\*\*/XCUIElementTypeStaticText[`label == "Mar 31, 1999"`]  
//XCUIElementTypeStaticText[@name=“Mar 31, 1999”] - “ **Mar 31, 1999** ” _part of locator is dynamic and can change anytime to another date._

I was thinking as below but not too sure:  
//XCUIElementTypeStaticText[matches(@label, “^[A-Z][a-z]{2} \d{2}, \d{4}$”)]

---

<div class="post-metadata">

**Author:** ![wreed](https://discuss.appium.io/letter_avatar_proxy/v4/letter/w/919ad9/32.png) [@wreed](https://discuss.appium.io/u/wreed)\
**Post date:** [February 7, 2023, 4:40am UTC](https://discuss.appium.io/t/locator-with-date-in-it-dynamic/38468/2 "2023-02-07T04:40:39Z")

</div>

Just my opinion, but while a regular expression is nice and should work, it would be far better to ask the developers to add an accessibility id to that element.

[https://medium.com/the-ministry-of-testing/adding-accessibility-identifiers-to-an-ios-app-c8e09d9c20f3](https://medium.com/the-ministry-of-testing/adding-accessibility-identifiers-to-an-ios-app-c8e09d9c20f3)

---

<div class="post-metadata">

**Author:** ![Aleksei](https://discuss.appium.io/user_avatar/discuss.appium.io/aleksei/32/6267_2.png) [@Aleksei](https://discuss.appium.io/u/Aleksei)\
**Post date:** [February 7, 2023, 8:39am UTC](https://discuss.appium.io/t/locator-with-date-in-it-dynamic/38468/3 "2023-02-07T08:39:16Z")

</div>

start from third post and further -\> [Dynamic Locator in iOS App](https://discuss.appium.io/t/dynamic-locator-in-ios-app/38450/3)
