Mantis - Quercus
Viewing Issue Advanced Details
2907 minor always 09-05-08 01:23 09-09-08 10:56
wikipo  
nam  
normal  
closed 3.1.6  
fixed  
none    
none 3.2.1  
0002907: Regex option 'A' ignored
When a regex expression uses option 'A', the match functions must use the offest specified.

I have found this in mediawiki 1.12 code in this expression:

  $elementsRegex = "~($xmlishRegex)(?:\s|\/>|>)|(!--)~iA";

subsequently used in a call to preg_match with offset specified.
I think the semantics of option 'A' is to anchor the search to the offset specified relative to the beginning of the text, while option '^' means to anchor to the beginning of the text.

I changed the test in RegexpNode.AnchorBegin.match:

// if (offset == 0)
        if (offset == state._first)

This solves the problem at least for mediawiki.

Notes
(0003414)
nam   
09-09-08 10:56   
php/153h