How can I build a regular expression that will match a string of any length containing any characters but which must contain 21 commas?
Exactly 21 commas:
^([^,]*,){21}[^,]$
At least 21 commas:
^([^,]?,){21}.*$
What language? There's probably a simpler method.
For example...
In CFML, you can just see if ListLen(MyString)
is 22
In Java, you can compare MyString.split(',')
to 22
etc...
.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,