How to stop a match in regex ?

Hi Group (and more specifically Kem …)

I cannot get out of this regex thing .
suppose I have a header of text, then I want to match some text( in fact one word), then stop the search on a footer
I came with a regex like this : Header([a-zA-Z0-9].*)Footer
what does stop the regex from matching inside the parenthesis ? Footer ? but for me it does not work.
my footer in my case is a chr(0) so \\cA in regex and it does not stop it goes on to the end of the document.

how can you stop the match on some text (or special char) you want ?
thanks.

Because another Footer occurs at the end of the document? Turn off the Greedy option.

thanks Kem, it’s better but still not complete.
it seems it has difficulties to stop on a control char ? I would like to stop on “\000\cK\f” will it work or do I need special care for it ?

No, that should work. PCRE doesn’t really care what the actual bytes are in the string it’s matching.

Remember that, unless you set the proper option or include a switch, .* will not match an end-of-line character. I will sometimes use this instead: [\\s\\S]*. That will match any character that is or isn’t white space, i.e., anything.