Boost logo

Boost-Build :

Subject: [Boost-build] MATCH regular expression issue
From: wash (admin_at_[hidden])
Date: 2011-02-13 02:38:14


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The documentation for MATCH (bjam builtin rules) states:

  "Matches the egrep(1) style regular expressions [...]"

This is not entirely accurate.

  if [ MATCH "12[.]0|12" : "11.0" ] { ECHO "version 12" ; } # does not echo
  if [ MATCH "12[.]0|12" : "12.0" ] { ECHO "version 12" ; } # does not echo
  if [ MATCH "(12[.]0|12)" : "12.0" ] { ECHO "version 12" ; } # echoes

egrep is command-line syntactic sugar for `grep -E' (extended regular
expression, specified in POSIX, aka ERE). The above behavior (aka the failure
to match w/o parens) does not match the behavior described by POSIX or
implemented by well known grep distros:

  wash_at_pegasus:~/boost$ egrep --version
  GNU grep 2.6.3

  Copyright (C) 2009 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
  This is free software: you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.

  wash_at_pegasus:~/boost$ echo "11" | egrep "12[.]0|12"
  wash_at_pegasus:~/boost$ echo "12.0" | egrep "12[.]0|12"
  12.0
  wash_at_pegasus:~/boost$ echo "12.0" | egrep "(12[.]0|12)"
  12.0

I do not understand why I need to add the parens in bjam. Is this a bug? Is this
intention? Either way, can we either change this behavior, or change the docs?

- --
Bryce Lelbach aka wash
boost-spirit.com

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAk1XimcACgkQ9cB/V3/s9ExTtQCfRQYiJxuef9JUZSggvTvplxX6
oa8AnjCZJl48HWhHcrbm5VUdEu7SIp0O
=cOqK
-----END PGP SIGNATURE-----


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk