views:

432

answers:

1

I am using the matches string builtin and need to run a regex pattern

(Views:).*?(span>)(.*?)(<\/div)

However, Freemarker freaks out because of the ">" character which is a special character in Freemarker. Any ideas how to get round this?

+1  A: 

Use \l for < and \g for >.

Taken from a FreeMarker documentation page which was second item in a Google search for "freemarker escape string".


Oh and be careful trying to parse HTML with regex - with uncontrolled markup it turns difficult very quickly.

Peter Boughton