I am able to construct regex for leading and trailing.
(^[,\s]+)|([,\s]+$)
But I don't know to how to negate it, it should check for non-leading and non-trailing commas.
And it should not contain double or more commas (near to each other) in the middle.
// example - should return following values
1. "orange" - true
2. "apple, orange" - true
3. "apple, orange" - true
4. "apple,orange" - true
5. "apple, orange," - false
6. ",orange, apple" - false
8. "orange,, apple" - false
9. "apple,,orange" - false
Any here does know how to achieve. thanks