Skip to content

Commit 976da32

Browse files
committed
Use \A \z for checking regex on legal
1 parent 7446d7c commit 976da32

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: lib/bson/object_id.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def from_time(time, options = {})
282282
#
283283
# @since 2.0.0
284284
def legal?(string)
285-
string.to_s =~ /^[0-9a-f]{24}$/i ? true : false
285+
string.to_s =~ /\A[0-9a-f]{24}\z/i ? true : false
286286
end
287287

288288
# Executes the provided block only if the size of the provided object is

0 commit comments

Comments
 (0)