I need to write a pattern that will search for the correct isbn numbers in the file and later I will output them
You only need the pattern itself implemented through regular expressions
Here’s what I roughly got:
string pattern = @"b(?:ISBN(?:-1[03])?:?s*)?[-0-9]{1,5}[- ]?[0-9]+[- ]?[0-9]+[- ]?[0-9]+[- ]?[0-9X]b";
however, with the input data
ISBN 978-5-317-04434-3
ISBN 978-5-93286-181-3
ISBN 5-272-00341-1
ISBN 5-272-00251-1
ISBN 5-272---00251--1
ISBN 0-12-345678-9
it outputs:
ISBN 978-5-317-04434-3
ISBN 978-5-93286-181-3
ISBN 5-272-00341-1
ISBN 5-272-00251-1
272---00251
ISBN 0-12-345678-9
however, it is expected that it will be withdrawn
ISBN 978-5-317-04434-3
ISBN 978-5-93286-181-3
ISBN 5-272-00341-1
ISBN 5-272-00251-1