Skip to content

Commit fb6dcb7

Browse files
committed
Fixed regexp that match unintended string in README.md.
In ruby, regexp default mode is multiline mode.
1 parent 925a3fb commit fb6dcb7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ You can define validations and coercion options for your parameters using a `par
684684
```ruby
685685
params do
686686
requires :id, type: Integer
687-
optional :text, type: String, regexp: /^[a-z]+$/
687+
optional :text, type: String, regexp: /\A[a-z]+\z/
688688
group :media do
689689
requires :url
690690
end
@@ -1152,7 +1152,7 @@ end
11521152
```ruby
11531153
class AlphaNumeric < Grape::Validations::Base
11541154
def validate_param!(attr_name, params)
1155-
unless params[attr_name] =~ /^[[:alnum:]]+$/
1155+
unless params[attr_name] =~ /\A[[:alnum:]]+\z/
11561156
fail Grape::Exceptions::Validation, params: [@scope.full_name(attr_name)], message: 'must consist of alpha-numeric characters'
11571157
end
11581158
end

0 commit comments

Comments
 (0)