in reply to Regex an Array?

By array, do you mean "string with multiple occurrences of a pattern"? That's what your example looks like you mean. To ensure that a string is a comma-separated list of digits (and nothing else), the regex would be:
/^[0-9]+(?:,[0-9]+)*$/;
You anchor at the front and end to say that the whole string must match the pattern. You group and quantify to indicate repetitions.

Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re^2: Regex an Array?
by ikegami (Patriarch) on May 02, 2005 at 17:49 UTC
    He had spaces in his input string. I presume he wants you to allows spaces too. If you're going to take his question literally, then /^(?:[0-9,]*)$/ would suffice.
      I didn't notice the spaces until I first saw your earlier solution. This solution isn't quite right unless you accept ",,," as a valid input.

      Caution: Contents may have been coded under pressure.
      Considering the OP named it 'checked_ids' I was more or less interpreting that as meaning that that is where he will store the result of the check, not the actual data that needs to be tested. Dear OP, please enlighten us :-)

      Remember rule one...