0

I want to match everything starting from the line /Subtype /Widget until the line <<

With this code nothing is matched

preg_match('#/Subtype /Widget([.\s]*)<<#', $pdf, $matches);

subject

522 0 obj 
<<
/Subtype /Widget
/V (some text)
/T (Kreditor)
/Rect [54.6 359.16 296.4 531.84]
/P 414 0 R
/DA (/Helv 8 Tf 0 g)
/Ff 8392704
/Type /Annot
/F 4
/TU (Kreditor:)
/AP 
<<
/N 534 0 R
clarkk
  • 27,151
  • 72
  • 200
  • 340
  • 2
    `.` matches across lines when you add `s` modifier. `'#/Subtype /Widget(.*?)<<#s'`. Note you might also need a lazy quantifier, `*?`, rather than `*` greedy one, if you have multiple occurrences in the string. – Wiktor Stribiżew Jul 05 '19 at 12:28
  • great answer.. I already tried with `/s` but `*?` did it :) thanks – clarkk Jul 05 '19 at 12:37

0 Answers0