Skip to content
Advertisement

Tag: regex

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 [,d]* – zero or more commas/digits

Simple regex on string

I’m working on a simple mention system and in my PHP script and I need to extract client:6 from the larger text where one or more @mention like @[John Doe (#6)](client:6) will be present. Ex. This is my text how do you like it @John and do you have any thoughts @Jane In php the string will look like. and

Regexp: find all occurences on same string inside brackets

i already few days trying write some regexp for replacing all : inside brackets, pls help me, so i have string: how i can get all : and replace it with / ? i trying something like: but it’s find only last : Answer In a general case, it will look like See the regex demo. Remove the last +

Wrap Latex Equation using custom tag PHP regex

I just want to wrap the Math latex equation using any html tag. The string be like y = x2  or (x = sqrt{y}) . For all (y geq 0), x is defined. Thus, y is set of all non-negative and real number. Hence, range is (y geq 0) or [0, ∞). I want output like y = x2  or <math>(x = sqrt{y})</math>

PHP Regex: Remove words not equal exactly 3 characters

An excellent “very close” answer at Remove words less than 3 chars with DEMO where Regex removes all words less than 3 chars. But how to reset this demo vise versa ? to remove all words NOT EXACTLY EQUAL 3 chars ? We can catch word where exactly 3 chars by but how to tell regex – remove all other

Advertisement