Copilot commented on code in PR #3317:
URL: https://github.com/apache/tika/pull/3317#discussion_r4238337802
##########
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/ooxml/FieldCodeParser.java:
##########
@@ -44,9 +44,41 @@ public class FieldCodeParser {
"LINK\\s{1,100}[\\w.]{1,50}\\s{1,100}\"([^\"]{1,10000})\"",
Pattern.CASE_INSENSITIVE);
+ // REF/PAGEREF/NOTEREF <bookmark>; Word bookmark names are at most 40
characters
+ private static final Pattern BOOKMARK_REF_PATTERN =
+
Pattern.compile("^(?:REF|PAGEREF|NOTEREF)\\s{1,100}([\\p{L}\\p{N}_]{1,40})(?:\\s|$)",
Review Comment:
This pattern rejects valid quoted bookmark arguments such as `REF "_Ref100"
\h` and `PAGEREF "target"`, because the capture must begin immediately after
whitespace. The repository's Word-field fixture
`testRTF_nestedHyperlinkPageRef.rtf` already demonstrates quoted `PAGEREF`
syntax; the equivalent DOCX field will therefore remain plain text. Accept
consistently quoted or unquoted bookmark names and add a quoted DOCX case.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]