Re: Help with find text command
Re: Help with find text command
- Subject: Re: Help with find text command
- From: "Mark J. Reed" <email@hidden>
- Date: Wed, 1 Aug 2007 14:09:25 -0400
On 8/1/07,
Wallace, William <
email@hidden> wrote:
Seems to work fine up to a point. However, it occurred to me that the regexp
could match this string: "0-0-0-0". Which is not at all what I want.
Well, that's what you described. :)
I'm looking for 10 digit ISBNs in the block of text (which should always be 13
characters--10 digits divided into 4 substrings by 3 hyphens).
Do you have to preserve the groupings? If you just ran all the strings through a hyphen-remover routine first the regular _expression_ devolves to \d{10}.
Counting is one of the things regular expressions don't do. What modern text processing systems have are extended beyond the formal definition of regular expressions and can actually do some forms of counting, but I don't think those tricks help here. I could be wrong, of course. But as far as I can tell, with a regular _expression_ the only way you're going to match all of the fully-hyphenated possibilities is to list all the possible patterns - from \d{7}-\d-\d-\d through \d-\d-\d-\d{7} - as alternates separated by |. Since there are 120 such patterns, that's kind of daunting. But if you know that not all 120 actually show up, that might help...
--
Mark J. Reed <
email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden