985
edits
(test issn for correct format;) |
m (13 revisions imported) |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 52:
local function check_isbn( isbn_str, error_string )
if nil ~= isbn_str:match("[^%s-0-9X]") then
return error_string;
end
isbn_str = isbn_str:gsub( "-", "" ):gsub( " ", "" ); -- remove hyphens and spaces
local len = isbn_str:len();
Line 61 ⟶ 63:
if len == 10 then
if isbn_str:match( "^%d*X?$" ) == nil then
return error_string;
end
return is_valid_isxn(isbn_str, 10) and '' or error_string;
else
local temp = 0;
if isbn_str:match( "^97[89]%d*$" ) == nil then
return error_string;
end
return is_valid_isxn_13 (isbn_str) and '' or error_string;
end
Line 111 ⟶ 117:
local valid_issn = true;
if not id:match ('^%d%d%d%d%-%d%d%d[%
return error_string;
end
|