Azu Posted November 27, 2007 Share Posted November 27, 2007 Hello I'm working on being my own BBcode parser, but I would like to get this out of the way before continuing. Please can somebody tell me a good way to implement [nocode] tags? The only ways I can think of are very bad/hacky solutions I think and have a chance of getting messed up. Hmm I was going to post an example but it seems this forum doesn't support [nocode] :/ but basically if there is an opening element before the nocode, and a closing one INSIDE IT, it would get messed up.. The only way around this I can think of is like randomly making a string of random characters and putting the stuff between the nocode tags into a subarray of that and then deleting it from the text and replacing it with the string of random characters, and later putting them back in after all the interpreting is done.. but I think that this is an extremely hacky of doing it and probably not very good performance either.. so I don't want to do it this way so I'm wandering if someone can please tell me a good way to do it.. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted November 27, 2007 Share Posted November 27, 2007 You talking about nesting stuff like if you had [tag ] Some text but wait a [tag ] in a tag! [/tag] some more text [/tag] and you don't want that inner tag closer to phrase out the upper one? your idea sounds like it will work, but that requires you to carry it across, maybe instead of a random character pattern you use a defined one and then do a simple find/replace of the set random string Quote Link to comment Share on other sites More sharing options...
Azu Posted November 28, 2007 Author Share Posted November 28, 2007 Yes like [underlinetag][nocode]This text has been underlined using [underlinetag][/underlinetag][/nocode][/underlinetag] I would really like a less hacky way of getting it to work. If the strings are pre-chosen there will only be so many of them (bug/limitation). And if somebody puts one or more of them in their post it could really mess stuff up (bug/exploit). So I will have to scan all of the text beforehand, for all of these strings to make sure they aren't in it (performance hit). I was hoping maybe somebody might be able to work some regex magic for me ^^ Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted November 28, 2007 Share Posted November 28, 2007 Well the only conclusion I can see without your exploit would be to some how split the input at the first of each tag, then address all the tags with an inner out system so to speak of Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.