Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does preg stand for in PHP's functions?

Tags:

regex

php

Does anyone know what the preg in preg_match, preg_grep, etc. stand for?

I know they use PCRE, which are 'Perl Compatible Regular Expressions.'

like image 355
Aillyn Avatar asked Aug 12 '10 17:08

Aillyn


People also ask

How does preg match work?

preg_match() in PHP – this function is used to perform pattern matching in PHP on a string. It returns true if a match is found and false if a match is not found. preg_replace() in PHP – this function is used to perform a pattern match on a string and then replace the match with the specified text.

How to use preg_ match function in PHP?

The preg_match() function searches string for pattern, returning true if pattern exists, and false otherwise. If the optional input parameter pattern_array is provided, then pattern_array will contain various sections of the subpatterns contained in the search pattern, if applicable.

What is PHP regular expression?

In PHP, regular expressions are strings composed of delimiters, a pattern and optional modifiers. $exp = "/w3schools/i"; In the example above, / is the delimiter, w3schools is the pattern that is being searched for, and i is a modifier that makes the search case-insensitive.

Which character is used to signify the beginning or the end of a word in a PHP regular expression?

Position Anchors There are certain situations where you want to match at the beginning or end of a line, word, or string. To do this you can use anchors. Two common anchors are caret ( ^ ) which represent the start of the string, and the dollar ( $ ) sign which represent the end of the string.


1 Answers

Perl REGular expression

like image 133
Scott Saunders Avatar answered Oct 18 '22 12:10

Scott Saunders