Snippets tagged “preg-replace”
16 snippets use this tag.
- Allow only [a-z][A-Z][0-9] in string using PHPPHP
You can use the preg_replace function in PHP to remove any characters that do not match the specified pattern.
- Convert plain text URLs into HTML hyperlinks in PHPPHP
You can use the preg_replace() function in PHP to convert plain text URLs into HTML hyperlinks.
- Delete particular word from stringPHP
In PHP, you can use the str_replace function to delete a particular word from a string.
- Function to return only alpha-numeric characters from string?PHP
To return only alpha-numeric characters from a string in PHP, you can use the preg_replace function with a regular expression pattern that matches any non-alphanumeric character.
- How can I remove part of a string in PHP?PHP
There are several ways to remove a portion of a string in PHP.
- How to match whitespace, carriage return and line feed using regular expression in PHP?PHP
In PHP, you can match whitespace, carriage return, and line feed using the following regular expression:
- How to minify php page html output?PHP
To minify HTML output in PHP, you can use the following steps:
- How to remove all non printable characters in a string?PHP
To remove all non-printable characters in a string in PHP, you can use the preg_replace function with a regular expression pattern that matches non-printable characters.
- How to remove line breaks (no characters!) from the string?PHP
There are a few different ways to remove line breaks from a string in PHP. Here are two options.
- How to Remove the First Character of a String with PHPPHP
In this short tutorial, we are going to represent to you the three main PHP functions that are used for removing the first character of a string.
- How to Strip all Spaces out of a String in PHPPHP
If you want to get the best solution to how to strip all spaces out of a string in PHP, you are in the right place. Read the snippet and choose your option.
- PHP preg replace only allow numbersPHP
You can use the preg_replace() function in PHP to only allow numbers in a string using a regular expression.
- Remove all non-numeric characters from a string; [^0-9] doesn't match as expectedPHP
You can use the preg_replace function in PHP to remove all non-numeric characters from a string.
- Remove control characters from PHP stringPHP
In PHP, you can use the preg_replace function to remove control characters from a string.
- Remove excess whitespace from within a stringPHP
To remove excess whitespace from within a string in PHP, you can use the preg_replace() function with a regular expression that matches any sequence of one or more whitespace characters.
- Remove new lines from string and replace with one empty spacePHP
To remove new lines from a string and replace them with a single empty space in PHP, you can use the str_replace function.