Archive for the ‘Regular Expression’ Category

PHP, Java and other languages provide replace all functionality to replace any character by any specific character. But REGEX is best method to replace or remove any specific value using pattern. Suppose, we have input string is $xyz = "This is my...

In php we have a function to replace nl2br means new line to break format. but when we need this functionality in our javascript code then what we do? We can do by simply manner: function nl2br(value) { return value.replace(/\n, ""); ...

Are you looking for a regular expression to make clickable url in the string? Yes!, you will get your solutions here: echo preg_replace("/http\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/", "$0", $string); If you want to open url in new tab...