Tagged Questions
0
votes
2answers
20 views
PHP - Using preg_replace to put http:// before link
I have a bbCode function I made:
function bbCode($str)
{
$values = array(
'@\[link="(.*?)"\](.*?)\[\/link\]@i' => '<a href="$1">$2</a>'
);
return ...
0
votes
1answer
28 views
SOLVED - PHP - preg_replace(): No ending delimiter '@' found
I am new at php and I was trying to create a BBcode but it gives me this error:
Warning: preg_replace(): No ending delimiter '@' found
The code I did:
function bbCode($str){
$values = ...
-3
votes
3answers
61 views
How to convert <div style=“xyz”> to [div style=“xyz”] with preg_replace php
I have an html string
$html = '<div style="background-color:#000;border:1px solid #000">
<b>Some Text</b></div><span>I have amount > 1000 USD</span>';
I want ...
0
votes
0answers
36 views
Convert bbcode without preg_replace
I'm using bbcode for my blog's admin section and I'm using this function (it works fine):
function bbcode_format($var) {
$search = array(
'/\[size=(.+?)\]/is',
'/\[color=(.+?)\]/is',
...
0
votes
0answers
21 views
Disordered bbcode elements
I've coded a bit around with preg in php so I could code myself some bbcodes.
It worked out fine at first, but I found out that when I do something like [b]Stuff stuff [b]and more stuff[/b][/b] its ...
0
votes
2answers
52 views
search diffrent tags and replace in a single preg_replace function
I have this kind of retrieved record from a database where I want to decode formatting values and replace it with appropriate html tag so that it will work fine on display:
...
1
vote
2answers
252 views
How can I convert HTML to bbcode using a regex? [duplicate]
Possible Duplicate:
bbcode unparser regex help
I want to convert this HTML code
<div class="postQuote"> <div class="postQuoteAuthor"><a ...
0
votes
1answer
114 views
Regex / Preg: No match, if found
I'm trying to do some PHP preg. But it seems to i can't get it to match if i want a string without something in it.
Example:
Hello! My name is [b]Peter Jack[/b]
If Peter Jack is found with his ...
0
votes
1answer
106 views
Preg_replace issue bbcode
I have a problem with the preg_replace function, I am trying to convert some bbcode into HTML but it is not working.
The one that I am trying to get to work is ...
0
votes
0answers
411 views
Safe preg_replace for BBCode [url=][/url]
I was looking around for a REGEXP BBCode for URLs. After looking a bit around, I found this.
$message = preg_replace('@\[url=([^]]*)\]([^[]*)\[/url\]@', '<a href="$1">$2</a>', $message);
...
1
vote
1answer
139 views
preg_replace everythin but content within bbcode
I'm trying to replace everything in my content with empty space except the content within my bbcode (and the bbcode itself).
This is my code to eliminate my bbcode.
The BBCode is just a little helper ...
-1
votes
2answers
103 views
Ereg to Preg string replacing [duplicate]
Possible Duplicate:
Converting ereg expressions to preg
How can I do this:
$temp_message = ereg_replace("\n", "\r", $temp_message);
$temp_message = ereg_replace("[\n\r]", "\t", ...
0
votes
1answer
113 views
Regex Preg_replace
I'm trying to do a preg_replace to convert come bbcode. Basically, this
[QUOTE=ksiva]blahblah blah[/QUOTE]
Needs to look like this
<div class=quote-msg"><div ...
1
vote
1answer
513 views
Preg_replace BBCode Link
I have this bbcode:
[url=http://www.youtube.com/watch?v=h1bIEK1h150]If I offer you my soul[/url]
for example. How can I turn this into this:
<a href="http://www.youtube.com/watch?v=h1bIEK1h150" ...
0
votes
0answers
172 views
preg_replace bbcode - quote tags overlapp [duplicate]
Possible Duplicate:
Best way to parse bbcode
I'm using this code:
$cnt = 1;
while($cnt != 0){
$text = preg_replace('#\[quote=(.*?)\;(.*?)\](.*?)\[\/quote\]#ms', '<blockquote ...