Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.0RC6

Bug #14438 Regular expression for removeCurlyBraces wrong
Submitted: 2008-08-03 06:11 UTC
From: baxissimo Assigned: doconnor
Status: Closed Package: Structures_BibTex (version 1.0.0RC4)
PHP Version: 5.2.6 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2008-08-03 06:11 UTC] baxissimo (Bill Baxter)
Description: ------------ 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 @ARTICLE{FOO, 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)) { die($ret->getMessage()); } $bibtex->parse(); echo $bibtex->data[0]['title']; Expected result: ---------------- FoOBaR: A system with StrAnGe capitalization Actual result: -------------- {FoOBaR}: A system with StrAnGe capitalization

Comments

 [2012-01-17 20:26 UTC] doconnor (Daniel O'Connor)
-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.