You need a delimiter for your pattern. It should be added at the start and end of the pattern like so:
$pattern = "/My name is '(.*)' and im fine/"; // With / as a delimeter
More Related Contents:
- PHP regular expressions: No ending delimiter ‘^’ found in
- preg_match(): Compilation failed: invalid range in character class at offset
- “Unknown modifier ‘g’ in…” when using preg_match in PHP?
- Optional Whitespace Regex
- Split camelCase word into words with php preg_match (Regular Expression)
- PHP – regex to allow letters and numbers only
- Extracting all values between curly braces regex php
- Function eregi() is deprecated [duplicate]
- Get repeated matches with preg_match_all()
- Unknown modifier ‘/’ in …? what is it? [duplicate]
- How to search in an array with preg_match?
- How to validate a domain name using Regex & PHP?
- Regular expression preg_quote symbols are not detected
- Test if a string is regex
- PHP email validation [duplicate]
- How to validate that a string only contain lowercase letters?
- How to get the shortest rather than longest possible regex match with preg_match()
- Get non-numeric characters then number on each line of a block of texf
- Detecting a url using preg_match? without http:// in the string
- Regex to match an IP address [closed]
- PHP validation/regex for URL
- Remove non-utf8 characters from string
- get everything between and with php [duplicate]
- How do I remove all specific characters at the end of a string in PHP?
- Can someone explain the /e regex modifier? [duplicate]
- How to “Validate” Human Names in CakePHP?
- regular expression and forward slash
- How to validate phone number using PHP? [duplicate]
- What does [\S\s]* mean in regex in PHP?
- UTF-8 in PHP regular expressions [duplicate]