View Single Post
Old 08-15-2022, 06:23 AM   #2
un_pogaz
Chalut o/
un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.
 
un_pogaz's Avatar
 
Posts: 439
Karma: 145424
Join Date: Dec 2017
Device: Kobo
substr() could be useful.

Here are some rules to color the ISBN as you want.
Maybe it's possible to make a not "advanced" versions of the rules, but in the meantime, this will do.

begins with 978 (ISBN-10 format 13)
Code:
program: test(strlen($#isbn)>10, cmp(substr($#isbn, 0, 3), 979, '', '#0af', ''), '')
begins with 979 (ISBN-13)
Code:
program: test(strlen($#isbn)>10, cmp(substr($#isbn, 0, 3), 978, '', '#f00', ''), '')
other isbn (ISBN-10 old format)
Code:
program: test($#isbn, '#5a7', '')
Note: important to put the rule "other isbn" after the others, otherwise all ISBN will be green.

Last edited by un_pogaz; 08-15-2022 at 04:39 PM.
un_pogaz is offline   Reply With Quote