I need to write a regex to match an element in a comma-separated list, ignoring whitespaces near ,.
For example:
elem1, elem2 ,elem3, elem4 ,elem5 ,elem6
Any of: elem1 elem2 elem3 elem4 elem5 elem6 should match.
The trailing comma (before end of line) is not allowed.
I tried this pattern:
pattern="(^|/,)\s*@{value}\s*(/,|$)"
but it doesn’t work. (False negative)
How can i do that pattern? What’s wrong in mine?
Thanks.
I found one solution:
The pattern is:
An usage example is: