I don’t have any idea about how to use regex. I want to validate my company field. For example: url.co url.com url.in Right now my PHP script takes any string but I want to validate it according …
Tag: regex
PHP preg_replace pattern NOT ending in ‘.zip’ or ‘.pdf’ or ‘.txt’
I want to preg_replace the following: $string=’‘; I want to add a target=”…
Filtering in Laravel using regex
I’m trying to filter products based on query string. My goal is to get products from a collection if it’s given, otherwise get every product. Could someone help me what’s wrong with the following code?…
Regex PHP – Get specific text including new lines and multiple spaces
I was trying to get the text starting from css:{(some text…)} up to the ending bracket only, not including the texts below in another text file using php. test.sample just a sample text css:{ “…
preg_quote() bug or strange behavior?
I used preg_quote() to escape some special characters. But in the test below, there is something I can’t understand. Why ‘date:1111aaa’ doesn’t match ??? <?php $PregArray = ['date:1111aaa', ':…
Remove HTML tags from input before sending
I have some chat script and I’m trying to filter the input field before clicking send or submit. This is my input filed: submit when im trying to send some tags like unfortunately is working what i need to do.. remove all attr tags from input or prevent to write html tags inside input because all of this data saved
Regexp to match groups containing optional parenthesis in the end of line
I need to extract a law text in Portuguese with three parts: prefix, body, meta, something like this: art. 3º Esta Consolidação estatui (teste 123) as normas que regulam as relações individuais. (abc …
regex php separate an exact word from string in diffrent groups
i have tried all i know but still can’t figure out how to resolve this problem : i have a string ex : “–included– in selling price: 5 % vat usd 10.00 packaging fees 2 % notifying fees” “–not …
Remove pieces of string
Ok, ive imported contents of .txt file into array, and im having problems with removing some parts of the string in array. This is the sample output of the array: [55] => …
PHP is not applying Regex to check void string
I made a regex Debuggex Demo which allows: NP123 FS-123 FS-123-456 or void works well on Debuggex, but and I don’t understand why PHP accept strings like “TEST” which is not part of the accepted templates Check the fiddler: https://www.phpliveregex.com/p/teA Answer You may use See the regex demo Details ^ – start of string (?: – start of an outer