I am a newbie. I was wondering how to do that, because i've always wanted to make a joke with my friend. Would you please answer? Thanks!
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Is there a way to play audio on a mobile browser w
You may wonder how it works. I'll try to explain how it should be done by various methods. We'll start first with how regex works and how it is used.
Regex - Regular expression
Basic Syntax
To use regular expressions first you need to learn the syntax. This syntax consists of a series of letters, numbers, dots, hyphens and special signs, which we can group together using different parentheses.
Brackets
Brackets
[]
have a special meaning when used in the context of regular expressions. They are used to find a range of characters.Examples
Let's look at how to use properly the operators. We will do this with an example of the word
hello
.The most common
Regex to match a URL
At first let's look how a URL is built. We only have a couple of options:
http://example.com/
https://example.com/
ftp://example.com/
www.example.com
user@example.com
127.0.0.1
http://example.com:8080/
http://
,https://
,ftp
,www
,mail
,ip
andport
.Method 1 (1/10 points)
Method 2 (5/10 points)
Method 3 (10/10 points)
You can write your own ideas to my answer.
I am writing...