3 ms·
Better for some things / worse for others. It was much easier to write parsers for though. Most of the BBCode tags could be rendered with simple regex substitu
by laumars 7y ago
Better for some things / worse for others.
It was much easier to write parsers for though. Most of the BBCode tags could be rendered with simple regex substitutions.
- contravariant 7y ago>It was much easier to write parsers for though. Most of the BBCode tags could be rendered with simple regex substitutions. Nevermind. Let's not bring BBCode back.
- laumars 7y agoOn the whole I'd agree. When markdown is done right it's pretty awesome. However I'd still take BBcode over buggy half implemented markdown parsers like the one we have on HN. At least [i] is a less common token than * -- which leads to no end of edits when I've absent-mindedly emphasised something that should have been bullet pointed. ...but yes, I do agree that markdown is definitely better when it's done right.
- CarlRJ 7y agoOn second thought, let us not go to Camelot. It is a silly place.
- brohee 7y agoSeriously... https://blog.codinghorror.com/regular-expressions-now-you-have-two-problems/ https://blog.codinghorror.com/regular-expressions-now-you-ha.... And this piece of computer trivia archeology http://regex.info/blog/2006-09-15/247 http://regex.info/blog/2006-09-15/247
- laumars 7y ago> Seriously... https://blog.codinghorror.com/regular-expressions-now-you-have-two-problems/ https://blog.codinghorror.com/regular-expressions-now-you-ha... . The key words I used were "most" and "simple". I'm well aware of the pitfalls of regex and have seen many horror stories myself but I'm not talking about parsing HTML nor other complex documents and nor am I suggesting you write the entire parser in regex. I'm talking about simple find and replaces for common static tags when you're only supporting a subset of BBcode. eg: form := "this is just a [b]crude[/b] example" rx := regexp.MustCompile(`\[b\](.*?)\[/b\]`) form = rx.ReplaceAllString(form, `<strong>$1</strong>`) fmt.Println(form) (https://play.golang.org/p/GK7OGt2mHb6 https://play.golang.org/p/GK7OGt2mHb6) You could even use string find/replace but that wouldn't capture missing closing tags. Things obviously get more complicated if you want to support some of the BBCode supersets like: click [url=example.com]here[/url] to load example.com ...but by that point you're dealing with a reasonably competent contributor who might feel better at home with markdown anyway (I know I would). > And this piece of computer trivia archeology http://regex.info/blog/2006-09-15/247 http://regex.info/blog/2006-09-15/247 Doesn't feel much like archaeology to me because I used to work a lot in Perl in the late 90s and 00s :) Though, and at risk of re-igniting old flamewars, I always preferred vi to emacs even despite having a fondness for LISP.
- CarlRJ 7y ago> Though, and at risk of re-igniting old flamewars, I always preferred vi to emacs even despite having a fondness for LISP. That's because vi is a better text editor (as the old saw goes, emacs is a nice OS, but it lacks a decent text editor.)