Re: [28595] trunk/dports/math/bc/Portfile
On Sep 4, 2007, at 03:34, source_changes@macosforge.org wrote:
Revision: 28595 http://trac.macosforge.org/projects/macports/changeset/28595 Author: mww@macports.org Date: 2007-09-04 01:34:17 -0700 (Tue, 04 Sep 2007)
Log Message: ----------- take maintainership, add sha1 checksum & livecheck
[snip]
+ +livecheck.check regex +livecheck.url http://ftp.gnu.org/gnu/bc/?C=M&O=D +livecheck.regex bc-(\[0-9\.\]+\[0-9\])\\. +
You don't need a backslash before a period in a character class. So livecheck.regex bc-(\[0-9.\]+\[0-9\])\\. would be better.
On 05.09.2007, at 11:58, Ryan Schmidt wrote:
On Sep 4, 2007, at 03:34, source_changes@macosforge.org wrote:
Revision: 28595 http://trac.macosforge.org/projects/macports/changeset/ 28595 Author: mww@macports.org Date: 2007-09-04 01:34:17 -0700 (Tue, 04 Sep 2007)
Log Message: ----------- take maintainership, add sha1 checksum & livecheck
[snip]
+ +livecheck.check regex +livecheck.url http://ftp.gnu.org/gnu/bc/?C=M&O=D +livecheck.regex bc-(\[0-9\.\]+\[0-9\])\\. +
You don't need a backslash before a period in a character class. So
livecheck.regex bc-(\[0-9.\]+\[0-9\])\\.
would be better.
O.k., but what does the backslash do then before a period? Nothing? -Markus --- Markus W. Weissmann http://www.mweissmann.de/
On Sep 5, 2007, at 06:33, Weissmann Markus wrote:
On 05.09.2007, at 11:58, Ryan Schmidt wrote:
On Sep 4, 2007, at 03:34, source_changes@macosforge.org wrote:
Revision: 28595 http://trac.macosforge.org/projects/macports/changeset/ 28595 Author: mww@macports.org Date: 2007-09-04 01:34:17 -0700 (Tue, 04 Sep 2007)
Log Message: ----------- take maintainership, add sha1 checksum & livecheck
[snip]
+ +livecheck.check regex +livecheck.url http://ftp.gnu.org/gnu/bc/?C=M&O=D +livecheck.regex bc-(\[0-9\.\]+\[0-9\])\\. +
You don't need a backslash before a period in a character class. So
livecheck.regex bc-(\[0-9.\]+\[0-9\])\\.
would be better.
O.k., but what does the backslash do then before a period? Nothing?
The string you write in your portfile is: bc-(\[0-9.\]+\[0-9\])\\. so that the string Tcl hands to the regex interpreter is: bc-([0-9.]+[0-9])\. In a regex in the portfile, one backslash escapes the next character from the Tcl interpreter. A period has no special meaning in Tcl, so "\." is the same as ".". At the end of your regex, you have "\\.". The first backslash removes the special meaning of the second backslash so that the regex engine sees "\." which in turn tells the regex engine to remove the special meaning of the period, so that instead of matching any character, it matches a literal period only. Within a regular expression, a period only has the special meaning of matching any character when the period occurs outside of a character class. Inside a character class, a period means a literal period. So the regex character class "[0-9.]" does not mean "match the characters zero thru nine and any character"; rather, it means "match the characters zero thru nine and the period".
participants (2)
-
Ryan Schmidt
-
Weissmann Markus