Skip to content

Tag: preg-match

PHP Preg_match for authorized characters

i’m a noob in regular expressions. Il would like to prevent a form for special characters. The characters auhorized are : I made a preg_match rule that makes problems I know that i should encapsulate special chars but i didn’t know to achieve this. Can you help me please ? Thanks in advance. Answe…

preg_match string from meta name

I want to preg_match number “20,956” from $url1 and number “2,894,865” from $url2 $url1: $url2: Tried this to work for both of urls, it works for only $url1 but not in $url2 Any Idea to make it work for both $url1&2? Answer You can use See the regex demo. Details: d – a digit…

Weird PHP Regex Preg_Match Bug?

My PHP version is PHP 7.2.24-0ubuntu0.18.04.7 (cli). However it looks like this problem occurs with all versions I’ve tested. I’ve encountered a very weird bug when using preg_match. Anyone know a fix? The first section of code here works, the second one doesn’t. But the regex itself is vali…

PHP Regex Match Specific Pattern between Quotes

I have strings with the following pattern: adfadfadfadfadfadfafdadfa”externalId”:”UCEjBDKfrqQI4TgzT9YLNT8g”afadfadfafadfdaffzfzfzxf Basically, I need to find “externalId” and extract it’s value in between the quotes that follow. The length of the value can change so i…