Now when i use this command($komentar is variable which is loaded from mysql): echo†bbcode($komentar); it shows me this error:Warning:†preg_replace()[function.pregreplace]:†Unknown†modifier †'/'†in†/home/dotars/public_html/includes/functions.php†on†line†212
i made a code for my forum does bbcode. Ive designed it so that me, the admin can input a template, such as if i wanted the template would be a ":" and then a ")" one after another,
then a function checks the post when you go to view it and see whether it has a template in it, if it doesnt it leaves it and if it does the function replaces the template with a replacment, which is also designated by the admin and stored in a database. Code:
I'm trying to replace such string: "Karcher HDS-C 7/11, 9/15, 8/15-E" with "HDS-C 7/11, 9/15, 8/15-E". I use this pattern "/[^A-Z0-9s.,-/()]/" for preg_replace. And instead of getting "HDS-C 7/11, 9/15, 8/15-E", I'm getting "K HDS-C 7/11, 9/15, 8/15-E" with leading K. So my rule: leave only words (1+ letters) in uppercase, 0-9, special chars; exclude words (2+ letters) that contain lowercase (first letter can be uppercase).
More examples (input => output): Karcher B 140 R Bp => B 140 R Bp Yard-Man YM 84 M-W 31AY97KV643 => YM 84 M-W 31AY97KV643 How can I adjust my pattern to get it work?
UPDATED: And I need to filter 1+ leading words in lowercase (with possible first letter in uppercase).
For example: Karcher Karcher B 140 R Bp => B 140 R Bp Karcher Karcher Karcher B 140 R Bp => B 140 R Bp
Paragraphs of text (SOME KNOWN TEXT)Unknown Text(SOME OTHER KNOWN TEXT) Some additional paragraphs of text
What I want is to keep the Unknown Text, but get rid of the (SOME KNOWN TEXT) and (SOME OTHER KNOWN TEXT).I think the preg_replace will give me what I want, but I need the regular expression to replace this:
(SOME KNOWN TEXT)Unknown Text(SOME OTHER KNOWN TEXT)
If someone posts a multi-line post that contained text and links, I want to be able to find and wrap the links with <p> tags, but I can only do it with one link at a time (source code comes from phpBB2 - clickable links function), which causes every link to be like this:
I use getimagesize to judge an image height and size. When a url has space, the getimagesize echo's an error. I've tried using urlencode() to transfer all the url address, it still returns an error. I noticed that if I just change the space into %20, getimagesize runs ok. I have no idea why? I also tired to use $newurl = preg_replace(' ', '%20', $url); It echo'ed :
I have a bunch of PDF's, some of them having Uppercase first letters and some having lowercase first letters.Right now my code is alphabetizing all of the Uppercase first letters first then all of the lowercase.I want them to be mixed.
I upload many details about documents into a database. To save on effort I copy and paste the headings into the appropraite fields rather than re-typing them. The problem with this is that document headings are all uppercase whilst other are not. To make it so all headings are formatted the same when dispayed on a web page I have written the following basic function... PHP Code: