> > $new_file =
> preg_replace('/\b(? > ' [tag]$1[/tag] ', $new_file);
> >
Replace the \w+ by [a-bA-Z]+
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Thx Erik, it works great except for one detail. It matches numbers too.
Can you fix it so it matches only words please ?
For example:
$file = 'this is a number 1231 test.';
$words = 'test|number';
Result: [tag]this[/tag] [tag]is[/tag] [tag]a[/tag] [tag]nu[/tag]
[sample]number[/sample] [tag]1231[/t
Hello Gregor,
On 13 Jan 2004 at 15:08, Gregor Jaksa wrote:
> hello, i need to replace some words in file with [tag]word[/tag] and other
> words with [sample]word[/sample].
>
> i have a list of words which i need to replace with [sample] tags declared
> like
> $words = 'word1|word2|word3|word4';
hello, i need to replace some words in file with [tag]word[/tag] and other
words with [sample]word[/sample].
i have a list of words which i need to replace with [sample] tags declared
like
$words = 'word1|word2|word3|word4';
replacing those words is easy i just use preg_replace('/\b( ' . $words .
Currently, I am parseing a string for href tags and adding a "target=_blank"
to them to have them open up in a new window using this:
$body = preg_replace("<[aA] [hH][rR][eE][fF]=\"(.*?)\">", 'a href="$1"
target=_blank', $row->body);
This works, to the best of my knowledge, however I was curious
5 matches
Mail list logo