--Ben
Marc A. Garrett wrote:
> Ben,
>
> Thanks for your assistance.
>
> For the record, I copied the RegEx from the web and didn't spot the end of
> string character in the middle of the pattern. Here's the pattern that
> worked:
>
> ISBN (?=.{13})\d{1,5}( |\-)\d{1,7}\1\d{1,6}\1(\d|X)
>
> Best,
>
> Marc A. Garrett
>
> [EMAIL PROTECTED]
>
>
>
>
>
> _____
>
> From: Ben Doom [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, January 14, 2004 2:00 PM
> To: CF-RegEx
> Subject: Re: problem with ISBN RegEx
>
> ISBN (?=.{13})
>
> Will always match ISBN, a space, and the next 13 characters. Note that
> I took the $ out of it, since that was your end-of-string problem.
>
> Anyway, I'm not sure about the rules for ISBN numbers, but your regex
> will never require a formatted number if ISBN is followed by at least 14
> chars. You might want to remove the (?=.{13}) bit alltogether and rely
> on the formatted number bit which follows, since that's going to be a
> stricter interpretation.
>
> --Ben Doom
>
> Marc A. Garrett wrote:
>
> > Can someone give me a hand with an ISBN RegEx? I need to extract a valid
> > ISBN that's entered by a hand scanner, which means it might have leading
> or
> > trailing characters. This string works for an ISBN as long as it has no
> > trailing characters:
> >
> > ISBN (?=.{13}$)\d{1,5}( |\-)\d{1,7}\1\d{1,6}\1(\d|X)$
> >
> > I tried removing the "end of string" character:
> >
> > ISBN (?=.{13}$)\d{1,5}( |\-)\d{1,7}\1\d{1,6}\1(\d|X)
> >
> > The RegEx matches strings with leading characters, but not with trailing
> > characters. For example, ReFindNoCase() for the following string
> correctly
> > returns 3:
> >
> > - ISBN 0-394-52836-0
> >
> > But even though the following string contains a valid ISBN,
> ReFindNoCase()
> > returns 0:
> >
> > ISBN 0-394-52836-0 ~I(J(
> >
> > Thanks for any assistance.
> >
> > Best,
> >
> > Marc A. Garrett
> >
> > [EMAIL PROTECTED]
> >
>
> _____
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
