in reply to Re^2: RegEx for OpenOffice::OODoc as in $doc->selectElementsByContent()
in thread RegEx for OpenOffice::OODoc as in $doc->selectElementsByContent()

> Can you shed some light?

I've updated the answer.

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
  • Comment on Re^3: RegEx for OpenOffice::OODoc as in $doc->selectElementsByContent()
  • Download Code

Replies are listed 'Best First'.
Re^4: RegEx for OpenOffice::OODoc as in $doc->selectElementsByContent()
by EigenFunctions (Beadle) on Jun 03, 2016 at 17:48 UTC
    The real problem is making the search case insensitive (i.e., the "i" modifier). I tried your approach and get this as an error message:
    Quantifier follows nothing in regex; marked by <-- HERE in m/? <-- HERE i:faith/ at D:/Apps (x86)/Perl32/site/lib/OpenOffice/OODoc/XPath.pm line 339.
    One nasty approach would be to preprocess the search term and add [] around each letter with upper and lower case versions of the letter. As I said, nasty.

    Thanks,
      EigenFunctions
      OpSys: Win7 Professional/Home Premium x64 Service Pack 1

      It looks like you may have missed the parens in the example choroba posted above.

      # fail (no parens in regex assignment) perl -wMstrict -E 'my $x="Faith"; my $r=q{?i:faith}; say "ok" if $x =~ + /$r/' Quantifier follows nothing in regex; marked by <-- HERE in m/? <-- HER +E i:faith/ at -e line 1. # success perl -wMstrict -E 'my $x="Faith"; my $r=q{(?i:faith)}; say "ok" if $x +=~ /$r/' ok

      So instead of '?i:faith' which I'm guessing you have, try '(?i:faith)'

        Yes! It works!

        It's not entirely clear to me why I need the surrounding parenthesis, but it works none-the-less.

        Your answer is another reason why I love Perl. There are so many people that are willing to help when there is an issue. Sometimes the solution comes from the developer of the package, while other times it comes from someone like yourself. In any event, Perl is a wonderful language, repository and community.

        Thanks so much for the support, it is genuinely appreciated.

        Thanks,
          EigenFunctions
          OpSys: Win7 Professional/Home Premium x64 Service Pack 1