Unknown modifier ” error preg_match
Running this error while adopting preg_mathc in php? Just check if the delimiters are not used in your string – mostly this would fix the problem.
$example = "<root><tag1>content1</tag1></root>"; $pattern = "/<tag1>.+</tag1>/"; preg_match($pattern, $example, $matches) ;
If you run the above snippet, you would run the error as the delimiter ‘/’ is the part of the string – so changing the delimiter, say, to ‘?’ would solve the problem. like
$pattern = "?<tag1>.+</tag1>?
Hope it would help.
See how you would solve these known algorithm problems
Get maximum occurring characterFind the pairs that makes K Complementary in the given array java solution
Find the first occurence of number in the sorted array
Check if two strings are anagrams or not
Array reversal in Recurrsion
find longest word in the sentence
Flatten nested javascript array
Changing decimal number to its binary equivalent
Implement Queue Using two Stacks – JavaScript algorithm
Kadane’s algorithm in C – Dynamic Programming