# Return True if Pattern is found anywhere within Text - Help

**URL:** <https://community.dynatrace.com/t/return-true-if-pattern-is-found-anywhere-within-text-help/56394>\
**Category:** DQL\
**Tags:** dql, notebooks, dpl, logs\
**Created:** [July 8, 2026, 3:41pm UTC](https://community.dynatrace.com/t/return-true-if-pattern-is-found-anywhere-within-text-help/56394 "2026-07-08T15:41:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![badgerfifteen](https://avatars.discourse-cdn.com/v4/letter/b/e68b1a/32.png) [@badgerfifteen](https://community.dynatrace.com/u/badgerfifteen)\
**Post date:** [July 8, 2026, 3:41pm UTC](https://community.dynatrace.com/t/return-true-if-pattern-is-found-anywhere-within-text-help/56394/1 "2026-07-08T15:41:49Z")

</div>

Hi,

I am formulating a DPL command to return true if a pattern such as a credit card format/number exists anywhere within a piece of text.

For example…

```markup
data record(a = "378282246310005")
| parse a, """CREDITCARD:cc"""
| fieldsAdd hasCreditCard = isNotNull(cc)

```

… this would return true, but the minute I add anything before or after it will return false. Any ideas on how to detect that pattern anywhere within a piece of text, or a log? Which is where this code/function is going to be used.

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [July 8, 2026, 5:56pm UTC](https://community.dynatrace.com/t/return-true-if-pattern-is-found-anywhere-within-text-help/56394/2 "2026-07-08T17:56:20Z")

</div>

[@badgerfifteen](https://community.dynatrace.com/user/67521)&nbsp;I think you just have your parse command incorrect, and you need to add LD\* (Line data, optional):

```markup
data record(a = "x378282246310005")
| parse a, """LD* CREDITCARD:cc"""
| fieldsAdd hasCreditCard = isNotNull(cc)

```

---

<div class="post-metadata">

**Author:** ![badgerfifteen](https://avatars.discourse-cdn.com/v4/letter/b/e68b1a/32.png) [@badgerfifteen](https://community.dynatrace.com/u/badgerfifteen)\
**Post date:** [July 9, 2026, 11:06am UTC](https://community.dynatrace.com/t/return-true-if-pattern-is-found-anywhere-within-text-help/56394/3 "2026-07-09T11:06:57Z")

</div>

Thanks, this works! I used this and changed and changed LD to DATA to account for log entries or pieces of text with new lines.
