Edit report at https://pear.php.net/bugs/bug.php?id=14438&edit=1

ID: 14438
Updated by: daniel.oconnor@gmail.com
Reported By: wbaxter at gmail dot com
Summary: Regular expression for removeCurlyBraces wrong
-Status: Open
+Status: Closed
Type: Bug
Package: Structures_BibTex
Operating System: Linux
Package Version: 1.0.0RC4
PHP Version: 5.2.6
-Assigned To:
+Assigned To: doconnor
Roadmap Versions:
New Comment:

-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: doconnor
This bug has been fixed in SVN.

If this was a documentation problem, the fix will appear on pear.php.net
by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should
be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.

Previous Comments:

[2008-08-03 02:11:55] baxissimo

The removeCurlyBraces option doesn't work on curly braces that appear
around the first word in an entry.

That's because the regular expression used is:

$pattern = '/([^\\\\])\{(.*?[^\\\\])\}/';

The text before the '{' is not optional, so it won't match if there's
nothing before. If you make "beginning of string" a possibility then it
seems to work properly:

$pattern = '/([^\\\\]|^)?\{(.*?[^\\\\])\}/';

Version info in what I'm using is:

* @category Structures
* @package Structures_BibTex
* @author Elmar Pitschke <elmar.pitschke@gmx.de>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: BibTex.php,v 1.16 2007/03/26 21:13:59 hugoki
Exp $
* @link http://pear.php.net/package/Structures_BibTex

Test script:
Run it on a bibtex file like this

title = {{FoOBaR}: A system with {StrAnGe} capitalization},

require_once 'Structures/BibTex.php';
$bibtex = new Structures_BibTex();
$bibtex->setOption('removeCurlyBraces', true);
$ret = $bibtex->loadFile('foo.bib');
if (PEAR::isError($ret)) {

echo $bibtex->data[0]['title'];

Expected result:
FoOBaR: A system with StrAnGe capitalization

Actual result:
{FoOBaR}: A system with StrAnGe capitalization


Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
postedJan 17, '12 at 2:25p
activeJan 17, '12 at 2:25p

1 user in discussion

Daniel Oconnor: 1 post



site design / logo © 2022 Grokbase