Project

General

Profile

« Previous | Next » 

Revision 4cae4d36

Added by Andreas Kohlbecker about 12 years ago

fixing taxon short name function, improved regex

View differences:

5.x/modules/cdm_dataportal/cdm_dataportal.module
1551 1551
     * - second capture group ([a-zA-Z]+): remaining letters of uninomial
1552 1552
     * - third capture group (\s+[^(\x2E]+\s+.+$): letters of name,
1553 1553
     *       but only matching if no '(' or '.' in second word of name, ( \x2E = '.' )
1554
     *       OR only one specific epithet \s+[a-zA-Z]+$
1554 1555
     */
1555
    $pattern = '/(^[a-zA-Z])([a-zA-Z]+)(\s+[^(\x2E]+\s+.+$)/';
1556
    $pattern = '/(^[a-zA-Z])([a-zA-Z]+)(\s+[^(\x2E]+\s+.+$|\s+[a-zA-Z]+$)/';
1556 1557
    if (preg_match($pattern, $nameStr, $matches, PREG_OFFSET_CAPTURE)){
1557 1558
      return $matches[1][0] . "." . $matches[3][0];
1558 1559
    } else {

Also available in: Unified diff