Danny Sauer Sent: 2006 Jan 24, Tue 14:07 > James wrote regarding 'RE: [OT] what about "wiki"' on Tue, > Jan 24 at 15:37: > > Now, the bold and underline would have been no easier in a > wiki. They > > would still require the [b][u] and the ending tags in reverse order > > [/u][/b] after that. > > Actually, the wiki I use does ''bold'' and '''underline''', > and most I've worked with don't use bbcode in general. ;) Wow, that is even more cryptic in my mind. If I were going to do that stuff, I would probably try to find a good regexp to do *bold words* and _underlined stuff_ as well as /italicised text or whatever./ I'd use - for bullet points at the start of a line and # for numbered lists. But as Olin points out, that could be just as confusing if it were not expected. > > If people really want, I can add a little translator that > converts any > > lines starting with a * into a
  • and puts a after the last.... Finding the first and last > may be a bit > > tricky... Lets see... > > It'd be easier if you used a state machine which remembers > whether or not it's in a list. If it's not in a list, it > appends a in front of the line which wasn't subject to > replacement and switch state back to "not in a list". Much better idea. But I don't think I'll implement the idea anyway. > > Replace $\* with $\ which is dead easy > > > > Then replace $[^<][^L][^I][^>](.*)\n\ with $1\<\/UL\>\ > > > > and replace \(.*)\n[^<][^L][^I][^>] with \$1\n\<\/UL\> > > > > Does that look right? Regexp gurus? > > Does your regexp environment of choice not support negative > assertions? Using three extra chars for each negative entity > seems bad, if for no other reason than legibility. :) Either > way, the second one will throw away a non-
  • tag preceding > a line with an
  • . You probably want to include the tag in > the group both in regexp2 and 3 as well as including the > newline in regexp2, like this: > > replace \*([^\n]+) with
  • $1
  • > replace ([^<][^L][^I][^>].*\n)
  • with $1 Ahh yes, thanks for the fix. Good grief, I even had $ and ^ reversed in my head. > Though that'd look prettier if you used line start 'n end > anchors and found a way to do a negative assertion - kinda > like (!
  • ). Of course, then you'd have to use $1$2 instead > of $1, etc... > > --Danny, amused that he complained about someone making a > regular expression illegible... Sort of an oxymoron huh? From http://techref.massmind.org/techref/language/regxs.htm Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. --Jamie Zawinski, in comp.lang.emacs --- James Newton: PICList webmaster/Admin mailto:jamesnewton@piclist.com 1-619-652-0593 phone http://www.piclist.com/member/JMN-EFP-786 PIC/PICList FAQ: http://www.piclist.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist