What are some ways to get matches using preg_replace in PHP?
preg_replace("/([A-Z])/", "<span class="initial">$1</span>", $str)
Tags: php regex preg-replace html-parsing
Source: By Polsonby as answer to the question
This code snippet was collected from stackoverflow, and is licensed under CC BY-SA 3.0
Related code-snippets:
- How do you enable a plugin for a PHP application?
- Flat file databases are generally stored in a computer hard drive. Flat file databases cannot be shared by any party with another.
- Is Object Property accessible from within object method?
- How can you track a downloaded file?
- How do I generate a tag cloud from an array using h1 through h6 for sizing?
- Is PHP session security really that important for web?
- What are the best ways to access Exchange using PHP?
- How do you keep your email address and password private while you are surfing the net?
- Why does PHP Variable pass by value when it should be passed by reference?
- How do I debug a PHP script?
- Regex: To pull out a sub string between two tags in a string in a regex code. I have a string with three tags; I am a string with ten tags, and there is a String between two tags. Regex: To pull out two tags in a string. Regex:
- Make Apache / XAMPP serve file outside of htdocs folder. Make XAMPP and Apache serve file outside of htdocs folder.
- How do I get authenticated user ID under Apache using PHP & HTTP Authentication?
- A method property uses an object property as default, so a method property is not used as a method property.
- Why is my ternary expression not working?