2

I have a JSON Path expression - $.[*].incentiveId which will return me an array of integers in the below format

[11791275, 11792924, 11792242, 11793924]

How do I write a regular expression for the above array of integers?

Note: The above array of integers size will vary everytime.

I have written the partial regular expression. ^[[0-9]*,\s and could anyone please help me in completing this regular expression?

revo
  • 47,783
  • 14
  • 74
  • 117
Srinivasan Ramu
  • 1,033
  • 4
  • 11
  • 23

1 Answers1

3

It seems Ready API uses Java for Regular Expressions then you are fine with below regex:

^\[\d+(?:,\s*\d+)*\]$

It matches ^ beginning of string, then a literal [ followed by any number of digits. An optional repeating group exists to match comma separated values then a literal ] and $ end of input string.

revo
  • 47,783
  • 14
  • 74
  • 117