Here comes the PHP regex master

Updated on technology 2024-02-25
7 answers
  1. Anonymous users2024-02-06

    Hello, although I haven't studied PHP, but in order to help you (and your 100 points) also take a little look, here are my opinions. Please forgive me if it is not right.

    First of all, I don't recommend that the landlord get the string array first and then replace them one by one with a loop.,I took a look at the preg replace method.,I copied one myself.。

    print preg_replace($pattern, $replacement, $string);

    The ** above is to replace, first get the string, then replace, and then split, so that you can reduce the loop.

    The following is a split regular expression.,Judging by the judgment.,I read what the landlord wrote seems to be a little bit unsure of what to take.,I'm here to take each one.,The regular expression is。

    [ g to explain the purpose of each symbol.]

    Escape to symbols"[", the same meaning.

    Take the middle ones"]"The content, the last ]+ is not greedy matching, which means that when you get a match, you stop, so that you won't take the whole string, if the landlord doesn't want both ends, you can change it to this.

    <=\[)=\])/g

    Do not consume numbers at both ends.

    I didn't run it in PHP, I just tried it in other languages, and I laughed

    ps: The amp sign in the $pattern regex in the first paragraph of ** must be written"& amp ;"(no spaces) don't let it be typed, remember!

  2. Anonymous users2024-02-05

    A hard disk partition is essentially a format of a hard disk before you can use the hard disk to save various information. When you create a partition, you have set the physical parameters of the hard disk, and specified the location of the master boot record (MBR) and boot record backups. For the file system and other operating systems, the information required to manage the hard disk is achieved through the subsequent advanced formatting, that is, the format command.

    In fact, it is completely possible to create only one partition and use all or part of the hard disk space. However, no matter how many partitions are divided, and whether you are using a SCSI hard drive or an IDE hard drive, you must set the main partition of the hard disk as the active partition before you can boot the system through the hard disk.

  3. Anonymous users2024-02-04

    regular expressions"/"is the mark of the beginning and end of the expression," can be Xiao Ji let the characters that appear after it be marked as special characters, and then demonstrate it in PHP:

    1. The regular expression is marked with as the beginning and end, and the expression syntax is wrapped in the middle of the two, as shown in the following figure.

    2. Next, to demonstrate that the expression of the following clever game matches n <>

    3, but if you add n in front of it, it will match the line break, as shown in the figure below.

    4. There are mainly the following characters that can be escaped in the lead book.

  4. Anonymous users2024-02-03

    Types and Introduction of PHP Regular Expression Modifiers:

    i: If you add it to the modifier"i", the regex will remove case sensitivity, ie"a"with"a"It's the same.

    m: Default regular start"^"and the end"$"Just for regular strings, if you add it to the modifier"m", then the beginning and end will refer to each line of the string: the beginning of each line is"^", the end is"$"。

    s: If added in a modifier"s", then the default"."Represents that any character other than a line break will become any character, i.e. including a line break!

    x: If this modifier is added, the whitespace character in the expression will be ignored unless it has been escaped.

    e: This modifier is only useful for replacement, which is used as php** in replacement.

    a: If this modifier is used, then the expression must be the beginning of the matching string. For example:"/a/a"Match"abcd"。

    e: with"m"Conversely, if this modifier is used, then"$"will match the end of the absolute string, not the front of the line break, which is turned on by default.

    U: It's pretty much the same as a question mark.

  5. Anonymous users2024-02-02

    A single string that describes or matches a series of strings that conform to a certain syntactic rule.

    A regular expression is a logical formula for string operations, that is, some specific characters and combinations of these specific characters are used to form a "rule string", which is used to express a filtering logic for strings.

    Given a regular expression and another string, we can do the following:

    1.Whether a given string conforms to the filtering logic of the regular expression (called a "match");

    2.You can use regular expressions to get the specific part we want from the string.

    Regular expressions are characterized by:

    1.Flexible, logical and functional;

    2.Complex control of strings can be achieved quickly and in a very simple way.

    3.For those who are new to contact, it is more obscure.

    Since regular expressions are mainly applied to text, they can be used in various texter occasions, from the famous EditPlus to large devices such as Microsoft Word and Visual Studio, which can use regular expressions to process text content.

  6. Anonymous users2024-02-01

    The regular expressions are basically the same in all languages, I don't know which regular expression you want to know and what is used to verify it?

  7. Anonymous users2024-01-31

    Regular expression, also known as regular expression, is often abbreviated as regex, regexp or re, which is a concept in computer science. Regular tables are often used to retrieve and replace text that fits a certain pattern (rule).

    A regular expression is a logical formula for manipulating strings (including common characters (e.g., letters between a and z) and special characters (called "metacharacters")) by using some predefined specific characters and their combinations to form a "rule string", which is used to express a filtering logic for strings. A regular expression is a text pattern that describes one or more strings to match when searching for text.

Related questions
12 answers2024-02-25

Variables can be included in double quotes, where $str reads look at the sea"$str";It will recognize that $str is a variable and explain the contents of the variable to get it"look at the sea", and single quotes'$str'It is to output the string $str, depending on the situation. Sometimes you need to make up a SQL statement with some variables, and double quotation marks are useful. >>>More

15 answers2024-02-25

You put $mysql=mysql query("select * from user where name='$name'");Change to $mysql=mysql query("select * from user where name='”.$name."'");Then print it in the update file to see if there is a value. >>>More

11 answers2024-02-25

In fact, there are a lot of integrated installation packages that can put everything in place for you at once, but it is not recommended to do that. >>>More

10 answers2024-02-25

Write by yourself You can create different tables in the database.

9 answers2024-02-25

If your html name is as regular as you say, you can write it smartly. >>>More