Today I’ve got two good tools for web developers.
Lately I’ve had to write a number of regular expressions for the upcoming mnartists.org calendar - most in Java, and a few in Javascript. In theory a regexp is a regexp no matter the language, but in practice that’s rarely the case. Between these subtle differences and the maddening wait for compiling or reloading a page, it’s clear some sort of live testing environment is useful:
- Javascript tester - allows replacement testing as well
- Java tester - really nice in that it gives accurate feedback on your regexp errors and even helps you format the matching text as a java String
If you’re a developer messing with Java or Javascript regular expressions, IMHO it’s worth bookmarking those two pages.
Here’s a Java one - looks complicated, actually pretty straightforward. Anyone care to take a stab at what it does? :)
line = line.replaceAll(”\[([bi])\]([^\[]*)\[/\1\]”,”<$1>$2</$1>”);
(or can you do it better? I get by, but I know my regexps are sometimes clunky at best…)
Sorry if you looked at this before this comment - I was having trouble getting WP to display the code line without messing it up. Looks good now, I think.
Comment by Nate Schroeder — 12/6/2006 @ 3:52 pm
Looks like it adds bold and italics around text (replacing non-html tags?).
Comment by Brent Gustafson — 12/6/2006 @ 4:08 pm
…close…
Comment by Nate Schroeder — 12/6/2006 @ 4:11 pm