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

The function doesn't seem to be documented. But maybe looking at its source can give you a clue? ref qr// returns true, so it's considered "context" instead of the pattern. Try specifying the regex as a string, not as an object.
$doc->selectElementsByContent('(?i:faith)');

Update: Code sample added.

($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,

Replies are listed 'Best First'.
Re^2: RegEx for OpenOffice::OODoc as in $doc->selectElementsByContent()
by stevieb (Canon) on Jun 03, 2016 at 15:30 UTC

    Hey choroba, I think the documentation for the methods in the Text library is simply separate from the code.

    Without being able to test, I came to the same conclusion... stringify the regex:

    $doc->selectElementsByContent('faith');

    However, I can't figure out how to include the case-insensitive modifier (/i) into such a thing. Can you shed some light?

      > 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,
        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