-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(ng-option): allow new line after _collection_ #4167
Conversation
Thanks for the PR!
If you need to make changes to your pull request, you can update the commit with Thanks again for your help! |
I just signed the CLA under the name of Efthymios Sarmpanis. |
@@ -127,7 +127,7 @@ | |||
var ngOptionsDirective = valueFn({ terminal: true }); | |||
var selectDirective = ['$compile', '$parse', function($compile, $parse) { | |||
//0000111110000000000022220000000000000000000000333300000000000000444444444444444440000000005555555555555555500000006666666666666666600000000000000007777000000000000000000088888 | |||
var NG_OPTIONS_REGEXP = /^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w\d]*)|(?:\(\s*([\$\w][\$\w\d]*)\s*,\s*([\$\w][\$\w\d]*)\s*\)))\s+in\s+(.*?)(?:\s+track\s+by\s+(.*?))?$/, | |||
var NG_OPTIONS_REGEXP = /^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w\d]*)|(?:\(\s*([\$\w][\$\w\d]*)\s*,\s*([\$\w][\$\w\d]*)\s*\)))\s+in\s+(.*?)(?:\s+track\s+by\s+(.*?))?(.*?)+$/, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should probably update the comment above too.
Can you provide a unit test that demonstrates the problem you have fixed as well please? |
Changed the regular expression to allow trailing spaces and new lines after _collection_ Closes angular#4142
I have altered the commit, updated the comment and added a test case. |
@jamie-pate the The |
While that all makes sense to me in separation, matching 'after the end' is
|
@jamie-pate actually it's not exactly "the end", it's more like "ends with" :) |
I'd love to see a good reference that explains it. every regex resource i've seen says similar :( |
@jamie-pate actually MDN is clear: "For example, If you try You could try things out here to get the hang of it. |
That is clear, in that it says exactly what i just quoted. "Matches end of input" (in this case, the last character of the string provided) Also [t$]* matches 't' and literal '$' (inside [] special characters aren't special) You could try things out here to get the hang of it. ;) |
Changed the regular expression to allow new line after collection
Closes #4142