function processString($s) {
return preg_replace('/https?:\/\/[\w\-\.!~#?&=+\*\'"(),\/]+/','<a href="https://stackoverflow.com/questions/4217406/"$0"">$0</a>',$s);
}
More Related Contents:
- Find a match pattern of any digit and space with any character in a string and replace with | in PHP [closed]
- Turn Plain Text URLs into Active Links using PHP [closed]
- How i can earn variable from string in PHP? [closed]
- How to Truncate a string in PHP to the word closest to a certain number of characters?
- Remove all special characters from a string [duplicate]
- Remove new lines from string and replace with one empty space
- Remove multiple whitespaces
- How to remove non-alphanumeric characters?
- How to mimic Stack Overflow Auto-Link Behavior
- Remove control characters from PHP string
- How to replace text URLs and exclude URLs in HTML tags?
- How do I linkify urls in a string with php?
- How to split a string by multiple delimiters in PHP?
- Get title of website via link
- Split camelCase word into words with php preg_match (Regular Expression)
- Extract URL from string
- Need a good regex to convert URLs to links but leave existing links alone
- Using PHP Replace SPACES in URLS with %20
- How to split a long string without breaking words?
- Php – regular expression to check if the string has chinese chars
- Close open HTML tags in a string
- Regex & PHP – isolate src attribute from img tag
- Remove accents without using iconv
- Remove all non-numeric characters from a string; [^0-9] doesn’t match as expected
- How to prefix a positive number with plus sign in PHP
- PHP regex for validating a URL
- How to validate that a string only contain lowercase letters?
- Replace all characters that aren’t letters and numbers with a hyphen [duplicate]
- Detecting a url using preg_match? without http:// in the string
- Regex to match an IP address [closed]