This time to bring you the PHP implementation of the regular expression grouping capture steps in detail, the PHP implementation of the regular expression grouping captures the attention of what, the following is the actual case, together to see.
After testing, it was found that the PHP regular expression gets the packet capture starting from $ A, while the regular work in JavaScript is $1..$9
When extracting Chinese characters from the project code, I was worried that the operation was very fast (in a hurry). The numeric order of the properties file {\d} was mistaken:
1, may start from {1} , instead of starting with {0}
2, may jump write, such as the first {0} the second need to replace the place is written {2}
Because manual operation is used manually, this situation is unavoidable and can only be said to reduce misoperation. Finished, you have to check again, this encounter difficulties, two thousand or three thousand lines of code, with the eyes of a row, that the more tired, and not necessarily can be checked out. More prone to error, and the line between the line is too close, the word is too small ...
Suddenly remembered, think PHP can save a little time, read the file, and then the key place red ...
Then it begins: Php reads the file, then reads it line by row, uses the regular expression to match {\d} rows, and then places {\d} with a red-focused mark, and then manually goes to see if each row is eligible for the rule. The code is wrong, but it's good, at least save the time to check with your eyes:
Such a glance swept past, it can be very clear that each line of the order is written correctly, the wrong line, the front row number, find the corresponding line and then change.
<! Doctype html>
Believe that you have read the case of this article you have mastered the method, more exciting please pay attention to the PHP Chinese network other related articles!
Recommended reading:
PHP replace article picture path to local server steps in detail
PHP's summary of source code encryption methods