The boss is not in, the arrogant regular

Source: Internet
Author: User

Hi

Rt

1. Regular expressions

--preg_grep ($pattern, Array$input)

Castrated version Preg_filter (), only match does not replace

--preg_split ($pattern, $subject)

Returns an array that splits the $subject at the $pattern split point

--preg_quote ($STR)

Escaping a regular operator to prevent confusion

.\+*? [^]$ () {}=!<>|:-

--Summary

Commonality: all start with Preg_

Basically the first parameter is $pattern

Usage: Form Validation-match

Illegal word filter-replace

Basic syntax for---regular expressions

--delimiter, Atom, quantifier, boundary control, mode unit

--delimiter:/or # or {} (usually not curly braces, too much ambiguity)

-Start and end positions

-$pattern = '/string/';

--regexpal Tools

-http://regexpal.isbadguy.com/

--Atomic

-Minimum matching units

-Visible atoms (Unicode encoded tables are visible in the mean keyboard): punctuation, various language literals, physics formula symbols, other visible characters

-Invisible atom: line break \ n, enter \ r, tab \ T, space, other

-usually direct input, meet duplicate or keyword, plus escape, such as \$

--Meta character

-Filter

| Match two or more, that is, or

[] match any atom in parentheses, special [1-3], here--the meaning of "to"

[^] ditto for reciprocal, matching all atoms in parentheses except

Note: With ^ to be careful, it will match all other invisible atoms, including spaces, and then there is the ^ to be written with the other atoms close to the head

-Define the set of atoms

. equivalent to [^\n], matches any character except newline characters--basically all

\d [0-9] matches a decimal number

\d [^0-9] matches a non-decimal digit

\w [0-9a-za-z] matches a number, letter, or underscore

\w [^0-9a-za-z] matches a non-numeric, letter, or underscore

\s matches a non-visible atom

\s matches a visible atom

--quantifier

-Indicates how many times an atom appears in succession

-{n} indicates that the atom in front of it happens to be n times in a row--5{3}

-{n,} indicates that the atom in front of it appears at least n consecutive times

-{N,M} [f|5]{3,6} indicates n times, up to M times, N to M

-* any time, as long as continuous, all match, {0,}

-? {0,1}0 to 1 times

-+ {1,} at least 1 times

2. PHP

---object-oriented

--What is an object

-object oriented (OO)

-All things are objects--all visible, invisible (an abstract concept), something

--The basic composition of the object

-Two parts: Properties and Methods

-Properties: Data model that describes the data of an object

-Method: Behavioral model for describing what the object can do

--Characteristics of the object

-Unique

-is a specific thing, function is to complete a specific function

-it can be reused.

-What is a Face object

-oriented, that is, programming is always thinking about the object (...)

-Object-oriented, that is, when programming, all data structures are stored through the structure of the object

-why: How objects are described (ideas), more fit to the real situation, and conducive to the understanding of large business

--Facing the substance of the object

-Store all the problems in your life in the form of objects, attributes + methods

-Interaction between objects and objects: completion of method invocation (consider the example of James playing basketball)

--The basic idea of object-oriented

-First step, identify the object

-Step two, identify the properties of the object--different types of concerns, different business logic for different objects

-Step three, identify the behavior of the object (through the behavior to identify its method)

--The basic principle of object-oriented

-The interior is high cohesion: only responsible for a specific function; The object's contents are all encapsulated inside, the attribute + method

-External is low-coupling: external only see some properties of the object, part of the method (behavior)-low coupling is more important than cohesion

The boss is not in, the arrogant regular

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.