MARC Review/MARC Global: PCRE and Saved review compatibility

This note is intended for users of MARC Review and MARC Global that have saved reviews created in versions 235 or earlier.

If you do not use these program modules, or have saved reviews from versions prior to 235, than you may safely ignore is note.

In version 236 we were alerted to a difference in the way that the program handles regular expressions during pattern matching (re: which, please see the last item on this page: http://www.marcofquality.com/w/doku.php?id=236:major_changes)

When creating new reviews, this difference should be apparent. However if you had older saved reviews using regular expressions, then please review the technical note that follows. The issue is that a few saved reviews may not work as expected in newer versions of the program.

TECHINCAL NOTE

The specific problem reported was the case of a pattern match of a literal string that included parentheses, located at the beginning of a field.

For example:

^(OCoLC)\d\d\d\d\d\d\d\d

Prior to 236, parentheses were not viewed as meta characters by the program and this pattern would match a string like

(OCoLC)12345678

After the update to support PCRE, however, parens become meta characters which delimit a subpattern. Thus, if the regular expression option is selected for the above pattern (which it should be, in order to match the beginning of the field '^', and the digit symbol '\d'), then this pattern will no longer match a string like '(OCoLC)12345678'.

In MARC Report version 236 and later, the pattern above should be written as:

^\(OCoLC\)\d\d\d\d\d\d\d\d

–where a backslash is used to escape the special meaning of the parens.

Note that there is no incompatibility when the regular expression option is not selected: a simple pattern of '(OCoLC)' will match correctly wherever it occurs.

There is also no issue if an unescaped parenthesis is used in a pattern _with_ the regular expression option selected; for example:

'(OCoLC'

In this case the program will complain about the problem with an error message that begins with 'TPerlRegEx.Compile - Error in regex …' the first time it evaluates the pattern.

This is the only incompatibility we have found so far between the old and new regular expression support. The conditions to look for are:

  1. any saved review created before version 236,
  2. includes two parens enclosing a string, and
  3. the regular expression option is selected.

It is possible that there may be other incompatibilities that are unknown to us at this time. Because of this, we advise cutomers to check any saved reviews created before version 236 that use regular expressions to be sure that they are still working as intended in the new environment.

238/pcre_and_savedreviews.txt · Last modified: 2013/04/27 09:09 (external edit)
Back to top
CC Attribution-Noncommercial-Share Alike 3.0 Unported
Driven by DokuWiki Recent changes RSS feed