Try it free

DPL Credit Card Data

  • Latest Dynatrace
  • Reference

CREDITCARD

Matches valid credit card numbers with a valid Luhn checksum in all varieties:

  • lengths (depending on the credit card scheme)
  • formattings (continuous, space-delimited, dash-delimited, mixed)
  • encodings (when submitted in the URL)

Use the following expression to parse credit card numbers:

CREDITCARD:result

For example, parsing credit card numbers in different formats:

Descriptioninput (string)result (long)

Continuous digits (Amex)

378282246310005

378282246310005

Continuous digits (Diners Club)

36227206271667

36227206271667

Continuous digits (Mastercard)

5500005555555559

5500005555555559

Continuous digits (Discover)

6011111111111117

6011111111111117

Space-delimited (Amex, 3 groups)

3782 822463 10005

378282246310005

Space-delimited (Diners Club, 3 groups)

3622 720627 1667

36227206271667

Space-delimited (Visa, 4 groups)

4111 1111 1111 1111

4111111111111111

Space-delimited (Mastercard, 4 groups)

5500 0055 5555 5559

5500005555555559

Space-delimited (Discover, 4 groups)

6011 1111 1111 1117

6011111111111117

Dash-delimited (Amex)

3782-822463-10005

378282246310005

Dash-delimited (Diners Club)

3056-930902-5904

30569309025904

Dash-delimited (Visa)

4916-3385-0608-2832

4916338506082832

Mixed dash and space (Visa)

4916-3385 0608 2832

4916338506082832

Mixed space and dash (Visa)

4916 3385-0608 2832

4916338506082832

URL-encoded spaces

4917%206100%200000%200000%20003

4917610000000000003

Invalid delimiter (dot)

4916.3385.0608.2832

null

Invalid length — too short

411111111111

null

Valid length, invalid Luhn

4111111111111112

null

Surrounded by non-digit characters

X4111111111111111X

null

Extra trailing digit

41111111111111117

4111111111111111

See how to use in DQL
data record(input = "378282246310005"),
record(input = "36227206271667"),
record(input = "5500005555555559"),
record(input = "6011111111111117"),
record(input = "3782 822463 10005"),
record(input = "3622 720627 1667"),
record(input = "4111 1111 1111 1111"),
record(input = "5500 0055 5555 5559"),
record(input = "6011 1111 1111 1117"),
record(input = "3782-822463-10005"),
record(input = "3056-930902-5904"),
record(input = "4916-3385-0608-2832"),
record(input = "4916-3385 0608 2832"),
record(input = "4916 3385-0608 2832"),
record(input = "4917%206100%200000%200000%20003"),
record(input = "4916.3385.0608.2832"),
record(input = "411111111111"),
record(input = "4111111111111112"),
record(input = "X4111111111111111X"),
record(input = "41111111111111117")
| parse input, "CREDITCARD:result"

Returns

The data type of the extracted value is long.

Practical examples

Example 1: Parse a credit card number from payment event

Given the following input:

txId=a1b2 card=4111111111111111

Use the following expression to extract the credit card number:

DATA CREDITCARD:result
result (long)

4111111111111111

See how to use in DQL
data record(input = "txId=a1b2 card=4111111111111111")
| parse input, "DATA CREDITCARD:result"
Example 2: Parse and mask a credit card number from record

Given the following input:

[2026-04-13] user=johndoe card=3782 822463 10005 action=checkout

Use CREDITCARD to capture the number, then replacePattern to overwrite all but the last four digits with X, masking the sensitive data while preserving the record structure:

DATA CREDITCARD:ccno

The replacePattern function locates the credit card number with the CREDITCARD matcher and substitutes the masked value built from the captured ccno:

result (string)

[2026-04-13] user=johndoe card=XXXXXXXXXXX0005 action=checkout

See how to use in DQL
data record(input = "[2026-04-13] user=johndoe card=3782 822463 10005 action=checkout")
| parse input, "DATA CREDITCARD:ccno"
| fieldsAdd result = replacePattern(input, "CREDITCARD", concat("XXXXXXXXXXX", substring(toString(ccno), from: -4)))
Related tags
Dynatrace Platform