[Surfraw-devel] OS X sed and basic regular expressions

Donavan-Ross Costaras d.costaras at gmail.com
Sun Nov 23 16:54:01 UTC 2014


Thanks fine, thanks.

Cheers,
d

Kyle Isom writes:

> Hello,
>
> Thanks for the report; it looks fine and I can merge this in. How would 
> you like your git author line to look (i.e. "Donavan-Ross Costaras 
> <d.costaras at gmail.com>")?
>
> Cheers,
> Kyle
>
>
> On 11/21/2014 02:23 PM, Donavan-Ross Costaras wrote:
>> Hi all,
>>
>> Can I suggest...
>>
>> --- surfraw-original    2014-11-21 23:40:16.000000000 +0200
>> +++ surfraw-fix         2014-11-21 23:40:59.000000000 +0200
>> @@ -324,7 +324,7 @@
>>
>>   list_elvi() {
>>       local dir="$1"
>> -    sed -n 's/^.*elvis:[       ]\+\(.*\)$/\1/p' $(find "$dir" ! -type d ! -type l ! -name '*~' | sort)
>> +    sed -n 's/^.*elvis:[       ]\{1,\}\(.*\)$/\1/p' $(find "$dir" ! -type d ! -type l ! -name '*~' | sort)
>>       for script in $(find "$dir" ! -type d -type l | sort) ; do
>>          printf '%-16s--> %s\n' $(basename "$script") $(basename $(readlink "${script}"))
>>       done
>>
>>
>> ...as OS X basic regular expressions do not support the `+'
>> metacharacter. I believe this is POSIX.2 and the `+' metacharacter is
>> non standard, though I may be wrong.
>>
>> On the dev list archive there is an OS X user who seems to have it
>> working but he may have forgotten his GNU sed symlink
>> http://lists.alioth.debian.org/pipermail/surfraw-devel/2011-October/000968.html
>>
>> Here is an extract of the OS X RE_FORMAT man page with the relevent section.
>>
>>       Obsolete (``basic'') regular expressions differ in several respects.  `|'
>>       is an ordinary character and there is no equivalent for its functional-
>>       ity.  `+' and `?' are ordinary characters, and their functionality can be
>>       expressed using bounds (`{1,}' or `{0,1}' respectively).
>>
>> I'd be happy to push the change myself though I've never done so for a
>> public project and would need guidance. A lot of tests seem to fail with
>> 503 or 403 but I suspect this change would not effect those on my OS X
>> system but would need to be tested in other OSes.
>>
>> Thanks for your time.
>>

-- 
Regards
Donavan



More information about the Surfraw-devel mailing list