0

I have this regex

(\((-?\d+.\d+\s?-?\d+.\d+,?)+\))*

that seems to be matching the space between characters at the very beginning of the string along with the parts that I would like to match.How can I change my regex to not match these as it causes empty arrays when converting to JSON?

zx81
  • 41,100
  • 9
  • 89
  • 105
vamsiampolu
  • 6,328
  • 19
  • 82
  • 183
  • Do you mean space between characters? Or do you mean empty string? I'm pretty sure that this regexp doesn't match spaces, but it certainly matches the empty string, because of the `*` at the end. – Dawood ibn Kareem Apr 27 '14 at 06:30
  • Please provide some input and expected outputs. – Braj Apr 27 '14 at 06:32

1 Answers1

1

Use + (one or more) instead of * (zero or more)

(\((-?\d+.\d+\s?-?\d+.\d+,?)+\))+

sshashank124
  • 31,495
  • 9
  • 67
  • 76