By default .
doesn’t match new lines – [\s\S]
is a hack around that problem.
This is common in JavaScript, but in PHP you can use the /s
flag to to make the dot match all characters.
More Related Contents:
- Slice an url with regex – php [closed]
- How to extract img src, title and alt from html using php? [duplicate]
- Matching Unicode letter characters in PCRE/PHP
- PHP Regex to get youtube video ID?
- Remove multiple whitespaces
- Variable-length lookbehind-assertion alternatives for regular expressions
- PHP Regular expression to match keyword outside HTML tag
- Replace multiple newlines, tabs, and spaces [duplicate]
- How to check if string is a valid XML element name?
- Split string by delimiter, but not if it is escaped
- Multibyte trim in PHP?
- Php – regular expression to check if the string has chinese chars
- How long can a TLD possibly be?
- Extracting all values between curly braces regex php
- PHP regex delimiter, what’s the point?
- Function to return only alpha-numeric characters from string?
- PHP using preg_replace : “Delimiter must not be alphanumeric or backslash” error
- Get repeated matches with preg_match_all()
- Unknown modifier ‘/’ in …? what is it? [duplicate]
- PHP – Add link to a URL in a string
- Regex to strip comments and multi-line comments and empty lines
- Issue with Laravel Rules & Regex (OR) operator
- How do I match accented characters with PHP preg?
- Youtube I.D parsing for new URL formats
- PHP and regexp to accept only Greek characters in form
- How to validate that a string only contain lowercase letters?
- Regular expression: find range except for one letter or a range
- How to get the shortest rather than longest possible regex match with preg_match()
- Regex to match an IP address [closed]
- PHP’s preg_replace regex that matches multiple lines