-1

Looking for the correct regex range to use in Google Tag Manager JS custom variable code.How do I match a range of 3 to 7 digits (meaning also everything in between)? Would it be: ^(\d{3-7})$

Thanks

Looked at individual regex examples including on stack overflow but not seeing this exact example listed. I've tried using separate code but realized the error I made in the code (why it didn't work as I had hoped).

Would it be: ^(\d{3-7})$

I expect the output to include every account number with 3, 4, 5, 6, 7 digits.

Anshu
  • 1,277
  • 2
  • 13
  • 28
Yesmaam
  • 11
  • 1

1 Answers1

0

You are close, and you may try this pattern:

^\d{3,7}$

A range (closed on both ends) for a given character or class is denoted using commas, not dashes.

Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360