Regular expressions may be used for string operations. a complex string may be used in the following format: & lt; br/& gt ;... & lt;/font & gt; & lt; br/& gt ;... & lt;/font & gt; & lt; br/& gt ;... & l operations on strings may require regular expressions and are complicated.
A string in the following format:
...
...
...
(That is, strings can be viewed
Start
Substring at the end of the string ).
Now I want:
Input an index value (for example, I). starting from 0, delete the sub-string I + 1 in this string. for example, if I = 1, delete the 2nd sub-strings in the original string
Start
The substring at the end of the string.
How can this problem be achieved?
------ Solution --------------------
Pcre_match_all ("/ (? :. | \ N | \ r) * <\/font> /IU ", $ str, $ array );
Echo"
";
Print_r ($ array );
You should have done the rest.
------ Solution --------------------
$ Str = preg_replace ('/((
. * <\/Font>
) {'. $ I .'})
. * <\/Font>
/IsU ',' \ 1', $ str );
------ Solution --------------------
A little thing I don't quite understand
What is isU ???