Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regex array (["number", "number",...])

Tags:

regex

ruby

Can you help me with expression for array: ["232","2323","233"]
I try this: /^\[("\d{1,7}")|(,"\d{1,7}")\]$/
But this expression is not working properly.
I use ruby(rails).

like image 763
Aleksei Avatar asked Jun 28 '26 22:06

Aleksei


1 Answers

This would validate the array structure well, blocking an entry like [,"123"]

^\[(("\d{1,7}")(,"\d{1,7}")*)?\]$
like image 148
Naveed S Avatar answered Jul 01 '26 21:07

Naveed S



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!