Doesn't \s+? mean the white space is optional?
No. The plus-sign means 'one or more.' The question-mark makes it
'non-greedy.' So \s+? will match the first instance of one or more
whitespace characters -- i.e. the first whitespace character.
The quantifier for 'zero or more' is the asterisk.
OK, trying to sort a file of movie titles.
This is where I got to:
Sort using pattern:
^(the|A|An|\d+)?\.?\s+?(.*)$
Given input like this:
All Quiet on the Western Front (1930)
05 In Washington (1943).avi
04. The Chimp (1932)
Almost.Famous (2000)
The 39 Steps (1935).avi
01 The Hound of the
On Tue, May 25, 2010 at 12:57:53PM -0600, LuKreme wrote:
OK, trying to sort a file of movie titles.
This is where I got to:
Sort using pattern:
^(the|A|An|\d+)?\.?\s+?(.*)$
Your regex requires whitespace at the beginning of the actual title, where
you might not have any, and also matches
On 25-May-2010, at 13:40, Ronald J Kimball wrote:
On Tue, May 25, 2010 at 12:57:53PM -0600, LuKreme wrote:
OK, trying to sort a file of movie titles.
This is where I got to:
Sort using pattern:
^(the|A|An|\d+)?\.?\s+?(.*)$
Your regex requires whitespace at the beginning of the actual
On 5/25/10 at 5:54 PM, krem...@kreme.com (LuKreme) wrote:
On 25-May-2010, at 13:40, Ronald J Kimball wrote:
On Tue, May 25, 2010 at 12:57:53PM -0600, LuKreme wrote:
OK, trying to sort a file of movie titles.
This is where I got to:
Sort using pattern: ^(the|A|An|\d+)?\.?\s+?(.*)$
On Tue, May 25, 2010 at 05:54:58PM -0600, LuKreme wrote:
Doesn't \s+? mean the white space is optional?
\s+ means match one or more whitespace characters, and as many as possible.
\s+? means match one or more whitespace characters, and as few as possible.
Either way there must be at least one