I have some trouble with a regex in JMeter. I have this form in HTML
Please don't use regular expressions for getting attribute values. There's so many corner cases in terms of character escaping and such that it's likely to break sometime. Look into XML processing APIs, like SAX, StAX, DOM or XSLT. Do mind that this requires the HTML to be XML compliant (if it's XHTML that's covered).
Once you get the value of your action attribute via a suitable API, you can then unleash regular expressions on it.
Alternatively, find out if you can somehow harness what already exists for handling HTTP posts/gets via the Servlet API or something similar. They place URL parameters in a map for retrieval.