$text = preg_replace('!/\*.*?\*/!s', '', $text);
$text = preg_replace('/\n\s*\n/', "\n", $text);
More Related Contents:
- Warning: preg_replace(): Unknown modifier
- Replace preg_replace() e modifier with preg_replace_callback
- Replace URLs in text with HTML links
- php regex to match outside of html tags
- Remove multiple whitespaces
- Convert plain text URLs into HTML hyperlinks in PHP
- Convert string into slug with single-hyphen delimiters only
- PHP remove special character from string
- Replace multiple newlines, tabs, and spaces [duplicate]
- Extract URL from string
- What Delimiter to use for preg_replace in PHP (replace working outside of PHP but not inside)
- Regular expressions for a range of unicode points PHP
- How to remove diacritics from text?
- PHP using preg_replace : “Delimiter must not be alphanumeric or backslash” error
- Replace only first match using preg_replace [duplicate]
- Unknown modifier ‘/’ error in PHP [duplicate]
- Replace tabs and spaces with a single space as well as carriage returns and newlines with a single newline
- How to properly escape a backslash to match a literal backslash in single-quoted and double-quoted PHP regex patterns
- regular expression and forward slash
- Regex / DOMDocument – match and replace text not in a link
- PHP Preg-Replace more than one underscore
- Regex ignore URL already in HTML tags
- need regex for youku video id [closed]
- Regex plus vs star difference? [duplicate]
- PHP Regex to check date is in YYYY-MM-DD format
- Need a good regex to convert URLs to links but leave existing links alone
- file_get_contents not working?
- Find JSON strings in a string
- laravel trailing Slashes redirect to localhost
- How to remove square brackets and anything between them with a regex?