regex question

Dan Shoop shoop at iwiring.net
Mon Apr 9 09:52:47 PDT 2007


At 10:37 AM -0400 4/9/07, János wrote:
>On Apr 5, 2007, at 7:26 PM, Dan Shoop wrote:
>
>>At 2:54 PM -0700 4/5/07, Ian Ward Comfort wrote:
>>>On Apr 5, 2007, at 2:16 PM, Dan Shoop wrote:
>>>>At 2:44 PM -0400 4/5/07, János wrote:
>>>>>Milo and Kreme gave some good tips, so for now I go with
>>>>>
>>>>>>>"^[ACNS][0-9]{2}-[0-9]{1,6}$"
>>>>
>>>>If your lib supports $, and I think that 
>>>>should be "^[ACNS][0-9]{2}-[0-9]{1,6}.*$" is 
>>>>you want to accept lines with stuff at the 
>>>>ends.
>>>
>>>What's the point of the upper bound on final 
>>>digits if you're going to accept any trailing 
>>>string with .*$ anyway?
>>
>>I'm not sure if he is,
>
>Yes, I am :) /Read original post/

No, it's not what you said:
At 11:31 AM -0400 4/5/07, János wrote:
>I need to match some strings that must start 
>with any of 'S', 'A', 'C' or 'N', followed by 
>two digits followed by a '-' /dash/, followed by 
>one to six digits.

The above does not say there may be things after 
the final one to six digits. The string must 
start with the characters S/A/C/N and then be 
followed by the rest but doesn't specify if 
that's all there is in the string or not. Hence 
my statement.
-- 

-dhan

------------------------------------------------------------------------
Dan Shoop                                                   AIM: iWiring
Systems & Networks Architect                      http://www.ustsvs.com/
shoop at iwiring.net                                http://www.iwiring.net/
1-714-363-1174

"The wise man doesn't give the right answers, he poses the right
questions." -- Claude Levi-Strauss

------------------------------------------------------------------------

iWiring provides systems and networks support for Mac OS X, unix, and
Open Source application technologies at affordable rates.


More information about the MacOSX-admin mailing list