How the regular matches the first one.
And the last one
such as the article below
1111111
2222222
33333333
4444444
55555555
66666666
7777777
Match out
1111111
In the
And the last paragraph
7777777
Of
How do you get it?
Share to:
------Solution--------------------
Preg_match_all ('/^
.+<\/p>
------Solution--------------------
. +<\/p>$/u ', $s, $m);
------Solution--------------------
$s =<<< TXT
1111111
2222222
33333333
4444444
55555555
66666666
7777777
TXT;
echo Preg_replace (' # ()(.+)(
) #s ', ' $1aaa$2$3bbb ', $s);
1111111
AAA
2222222
33333333
4444444
55555555
66666666
7777777
BBB
References:
Quote: References:
Quote: References:
If you just want to match
, you can use the regular.
PHP5, no one should use PHP4 now ...
$str = '1111111
2222222
33333333
4444444
55555555
66666666
7777777
';
$fp = Stripos ($str, '');
$first = substr ($str, $FP, 4);
$ep = Stripos ($str, '
');
$end = substr ($str, $EP, 4);
Wrongly written, $ep = Strripos ($str, '
');
The upstairs brothers and I want to be the same.
Actually, I want the first paragraph. Append some text, and the last paragraph to append some text
------Solution--------------------
reference:
Quote: reference:
Quote: reference:
If you just want to match
If you want, you can use the regular.
PHP5, no one should use PHP4 now ...
$str = ' 1111111
2222222
33333333
4444444
55555555
66666666
7777777
';
$fp = Stripos ($str, '
');
$first = substr ($str, $FP, 4);
$ep = Stripos ($str, '
');
$end = substr ($str, $EP, 4);
was incorrectly written, $ep = Strripos ($str, '
'); The
upstairs brothers and I think the same.