Category: PHP Tutorial

python tutorials and learn python

Created with Sketch.

Regex Non-greedy (or Lazy)

Regex Non-greedy (or Lazy) Summary: in this tutorial, you’ll learn about the regex non-greedy (or lazy) quantifiers that match their preceding elements as few times as possible. Introduction to the regex non-greedy (or lazy) quantifiers In regular expressions, the quantifiers have two versions: greedy and non-greedy (or lazy). In the previous tutorial, you learned how…
Read more

Regex Greedy

Regex Greedy Summary: in this tutorial, you’ll learn about the regex greedy mode and how it affects the way the quantifiers search for matches. The problem with the regex greedy mode Suppose you have the following string: <a href=”/” title=”Go to homepage”>Home</a> Code language: PHP (php) And you want to match the text within the…
Read more

Regex Quantifiers

Regex Quantifiers Summary: in this tutorial, you’ll learn how to use quantifiers in regular expressions to match a number of instances of a character or a character class. Introduction to regex quantifiers Quantifiers allow you to match their preceding elements a number of times. The following table shows the list of quantifiers: Quantifier Meaning *…
Read more

Regex Sets and Ranges

Regex Sets and Ranges Summary: in this tutorial, you’ll learn about the regex sets and ranges to create regular expressions that match a set of characters. Sets A set is one or more characters specified in square brackets. For example: [abc] Code language: PHP (php) Since a set matches any characters in the square brackets,…
Read more

Regex Word Boundary

Regex Word Boundary Summary: in this tutorial, you’ll learn to use the regex word boundary to match the word boundary position in a string. Introduction to the regex word boundary The word boundary anchor \b matches a position called a word boundary in a string. A word boundary’s position can be one of the following:…
Read more

Regex Anchors

Regex Anchors Summary: in this tutorial, you’ll learn how to use the regex anchors to match the start and the end of a string. Introduction to the regex anchors Unlike character classes, the regex anchors do not match characters, but a position before or after characters: ^ : The caret anchor (^) matches the beginning…
Read more

Regex Character Classes

Regex Character Classes Summary: in this tutorial, you’ll learn about the regex character classes and how to create regular expressions with patterns that match a set of characters. A character class is a set of characters, for example, alphabets, numbers, whitespaces. A character class allows you to create a regular expression with a pattern that…
Read more

PHP Regular Expressions

PHP Regular Expressions Summary: in this tutorial, you’ll learn about PHP regular expressions and functions that work with regular expression including preg_match(), preg_match_all(), and preg_replace(). Introduction to the PHP regular expressions PHP string functions allow you to test if a string contains a substring (str_contains()) or to replace all occurrences of a substring with another…
Read more

PHP ucwords

PHP ucwords Summary: in this tutorial, you’ll learn how to use the PHP ucwords() function to make the first character of each word in a string uppercase. Introduction to the PHP ucwords() function The ucwords() function accepts a string and returns a new string with the first character of each word converted to uppercase: ucwords…
Read more

PHP ucfirst

PHP ucfirst Summary: in this tutorial, you’ll learn how to use the PHP ucfirst() function to make the first alphabetic character uppercase. Introduction to the PHP ucfirst() function The ucfirst() function accepts a string and returns a new string with the first character converted to uppercase if that character is alphabetic. Here’s the syntax of…
Read more