regex differentiating between ISBN-10 and ISBN-13

前端 未结 5 559
后悔当初
后悔当初 2020-12-11 00:52

I have an If-else statement which checks a string to see whether there is an ISBN-10 or ISBN-13 (book ID).

The problem I am facing is with the ISBN-10 check which o

5条回答
  •  悲哀的现实
    2020-12-11 01:24

    Put the ISBN-13 check before the ISBN-10 check? This is assuming that you want to match them as a part of any string, that is (your example has an extra "ISBN:" at the start so matching anywhere in a string seems to be a requirement of some sort)

提交回复
热议问题