08 Jul 2026 04:41 PM
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....
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.
Solved! Go to Solution.
08 Jul 2026 06:56 PM
@badgerfifteen I think you just have your parse command incorrect, and you need to add LD* (Line data, optional):
data record(a = "x378282246310005")
| parse a, """LD* CREDITCARD:cc"""
| fieldsAdd hasCreditCard = isNotNull(cc)
09 Jul 2026 12:06 PM
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.
Featured Posts