I'm using Ruby and I have a string that is formatted like this:
id,part#,foreign_key_id,false
OR
id,part#,foreign_key_id,false|id,part#,foreign_key_id,true
the actual data would look something like this:
253,RFTL 9984.0,588,false
There may be one array with 0 pipe delimiters, or multiple arrays with multiple delimiters. I'm using the following regex to match the array data:
/\d*,.*,\d*,(true|false)/
However, I am not sure how to account for 0 or more | characters with 0 or more arrays. I thought about taking my original string and splitting it by | and then checking that each indices of the array matches my regex above, but this would be significantly slower than matching the entire string since I would have to loop through the every array indices so I am looking for a regex pattern to match the entire string.
false|idmean that that "field" contains either"false"or an id (that represents an integer). If so, do you wish to save it to one variable if it's"false"and another if it's an id? It would also be helpful to give a few example strings (not just the one).