PHP and regex: how to preg_match on multiple line?
php, regex
Solution
Instead of `m`, use the `s` (DOTALL) flag in your regex:
/.{1,25}59800.{1,25}/s
The `s` modifier is used to make DOT match newlines as well where `m` is used to make anchors `^ and $` match in each line of multiline input.
Problem
My HTML is: ``` line1 line2 line3 59800 line4 line5 line6 ``` My goal is to capture: (25 left characters)59800(25 right characters): I tried with ``` /.{1,25}59800.{1,25}/igm ``` But I only captures: ``` line3 59800 line4 ``` How do I capture multiple lines? Here is the test: http://regexr.com/39498