How to use regular expressions to match parentheses in PHP? I am collecting CURL data to obtain & lt; spanoncopy & quot; setClipBoardData () & quot; & gt; & lt; pclass & quot; jianju & quot; & gt ;............ & lt; p & gt; & lt; div & gt; & lt; span & gt; how to use regular expressions to match parentheses in PHP
I am collecting CURL data.
............
Content,
I use a regular expression to obtain the result.
The regular expression is written in
(.*)<\/p>
<\/p><\/span>
(.*)<\/p>
<\/p><\/span>
None. What should I do?
--- Solution --------------------
Try. No problem
If multiple rows are matched, the regular expression /...... /S to modify
PHP code
$ Html = <
............
Content, DOC; preg_match ('/
(. *) <\/P>
<\/P> <\/span>/', $ html, $ m); print_r ($ m [1]);
The above figure shows how PHP matches the content of parentheses with regular expressions. For more information, see PHP Chinese website (www.php1.cn )!
Related articles:
Summary of common PHP regular expression functions
What is a regular expression and its usage
Example of a simple php regular expression that matches Chinese characters