I've a regular expression that should validate if a string is composed by space-delimited strings. The regular expression works well (ok it allows a empty space in the end ... but that's not he problem) but takes too long when the validation fails.
The regular expression is the following:
/^(([\w\-]+)( )?){0,}$/
When trying to validate with the string
"'this-is_SAMPLE-scope-123,this-is_SAMPLE-scope-456'"
it takes 2 seconds.
The tests were performed in ruby 1.9.2-rc1 and 1.8.7. But this is probably a general problem.
Any idea?