Skip to content
Advertisement

Tag: regex

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

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

Advertisement