# Using regex to find the id

**URL:** <https://forum.katalon.com/t/using-regex-to-find-the-id/10116>\
**Category:** Web Testing\
**Tags:** web-testing, katalon-studio\
**Created:** [April 5, 2018, 2:49am UTC](https://forum.katalon.com/t/using-regex-to-find-the-id/10116 "2018-04-05T02:49:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kishor\_sharma](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kishor_sharma/32/16104_2.png) [@kishor\_sharma](https://forum.katalon.com/u/kishor_sharma)\
**Post date:** [April 5, 2018, 2:49am UTC](https://forum.katalon.com/t/using-regex-to-find-the-id/10116/1 "2018-04-05T02:49:15Z")

</div>

I want to fill in the text in a “textfield”.  
the “id” of the “textfiled” changes dynamically. The id is the “Donors\_1233klf323sd\_Ti” format. I want the regex to address the **dynamic** behavior of the ID.  
I used **regex** as in the screenshot. But it is not working.

[Screenshot\_1.png](https://s3.amazonaws.com/katalon-forum/editor/0k/kzbxuucgevt7.png)

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [April 5, 2018, 5:20am UTC](https://forum.katalon.com/t/using-regex-to-find-the-id/10116/2 "2018-04-05T05:20:55Z")

</div>

Your Regex is fine [https://regex101.com/r/Nzx8Kl/1](https://regex101.com/r/Nzx8Kl/1)

Report it as a bug – I’ve seen a few Regex problems in KS.

---

<div class="post-metadata">

**Author:** ![kishor\_sharma](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kishor_sharma/32/16104_2.png) [@kishor\_sharma](https://forum.katalon.com/u/kishor_sharma)\
**Post date:** [April 5, 2018, 5:32am UTC](https://forum.katalon.com/t/using-regex-to-find-the-id/10116/3 "2018-04-05T05:32:58Z")

</div>

@Russ Thomas thank you for the answer.  
Is there a way so that I can address dynamic ID? I’ve gone through all the discussions in the forum but I didn’t get my answer.  
Help will be appreciated.

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [April 5, 2018, 6:42am UTC](https://forum.katalon.com/t/using-regex-to-find-the-id/10116/4 "2018-04-05T06:42:34Z")

</div>

Alternative to Regexp, you can use XPath expression:  
You can select a div element with id=“Donors\_1233klf323sd\_Ti” by the following xpath:

```auto
//div[starts-with(@id, "Donors_") and substring(@id, string-length(@id) - string-length('_Ti')+1)="_Ti"]

```

---

<div class="post-metadata">

**Author:** ![albert.vu](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/albert.vu/32/20595_2.png) [@albert.vu](https://forum.katalon.com/u/albert.vu)\
**Post date:** [August 8, 2022, 7:32am UTC](https://forum.katalon.com/t/using-regex-to-find-the-id/10116/6 "2022-08-08T07:32:09Z")

</div>

Archived on August 8, 2022, 7:32am UTC


