How to use regular expression to determine if one file concluding ISBN series? on linux/unix.
And how about using Perl?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There isn’t an easy regular expression for ISBNs, as hyphenation is variable (see the hyphenation instructions). What you could do is strip out all hyphens or spaces from your string, then check to see if it’s 10 or 13 digits long (or 9 digits ending with either an
xor anX). However, this doesn’t handle verification of the ISBN, as the last digit (or letter, if it’s an[xX]) is a checksum that verifies the ISBN is valid.If you’re using Perl, what you want to do is use the
Business::ISBNmodule, which saves you all of this trouble.