ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello
Im writing a script language that looks like bbcode, so far, i did evrything with str_replace.
But i also need pictures, so i have to read text between [img ] and [/img ](minus those spaces).
So how do i do that?I hope sb can help me.
thanx Hylke
This will replace in inputstring the [ img ] and [ /img ] with an empty string (= remove it).
Like this you have in newstring just the content between the tags.
But nevertheless, if you really want to make it in a clean and much more elegant way, i suggest you to learn regular expressions (sooner or later you won't get around them anyway).
Last edited by Charalambos; 08-22-2004 at 03:27 PM.
Thats what i told you, you should learn how regular expressions work and how their syntax is in order to get that one straight. Thats why i showed you the version above avoiding regular expressions (in case you don't want to learn).
And btw, you just have to take Cedrik's example and substitute the string that is replaces those tags, and you have what you're looking for (if not, i didn't understand what you were looking for, and you have to tell me again).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.