I am using a javascript rich-text-editor to allow a content writer to
easily see what there content looks like, however, the content
management system that I have made would like to accept bbcode style
text. The problem is the text editor ueses spans with the style
attribute to get the desired effect(it uses the mozilla rich-text
editing api), I am looking at changing very complex spans:
<span style="text-decoration: underline, font-weight: bolder,
text-style: italic">
some text</span>
into very simple bbcode:
some text
I think I can manage links, horizontal rules and h# tags, but this
seems a little over my head, I cannot think of a way that I know will
work, and I think the answer is a regular expression(this executed on
the string before it is sent to the server), but I am not sure, and
would like some input, as opposed to struggling around with some crazy
thing that I probably won't be able to get to work.