I agree that that specific implementation is fairly ugly (particularly due to lack of comments and poorly chosen variable names), but the actual algorithm is extremely simple; if you were to manually look at the pattern and input string, you'd probably use the same algorithm in your head to test for a match.
That is probably #2 on my list of things you should never ever do, immediately below running untrusted code. The fact that you tout yourself as a security guy, and then turn around and recommend that someone actually generates regexp patterns on the fly makes me seriously question your integrity. You're naively assuming that regexps are known, tested, and built-in; in fact, none of those statements are true. Aside from that, there are plenty of other good reasons you shouldn't do it.
1) Throwing a slash before a every character is not sufficient for escaping in a regex; it's only by popular ignorance that characters are accepted in that way by some implementations
2) There is no guarantee that you can use regexps on all platforms; some JVMs simply don't support it, so you'll have to handle that situation anyways
3) If the JVM does give you a regexp implementation, there's no guarantee that it's going to be identical to the one you developed with. Regexps are one of the very few places where Java is famous for incompatibility; if you develop for Windows, you can be pretty sure that your regexp won't work on Linux - there's simply too many variants, and no authoritative standard on which one you'll get
I'm not trying to say that there are no conditions where regexp are useful or merited -- I do actually use them myself in my bot -- but I am saying that they're always undesirable. I use them to pick out URLs in the text area so that I can launch a browser when they're clicked on, which has a pretty high rate of failure anyways, so I only have to worry about the platforms that I support.
This is a case where the amount of work required to reinvent the wheel is significantly less than the amount of work required to handle every potential problem that could come up, even if you don't consider that that means writing your own pattern match algorithm to fall back on when regexps are unavailable.
I beg of you, do not generate regexp patterns on the fly! It's a wide open door just waiting to be exploited, and all you're doing is asking for trouble.