On Mon, 14 Feb 2005 12:48:48 +0100, jordi
John Maddock wrote:
With my undefined funtion I would obtain:
- Input text:"123 hello abc" - Latest rigth Regular expression: "(\d)+\s+(\w)+\s+" Matches: "123 hello " - First wrong regex: "(\d)+\s+(\w)+\s+(\d)+" does not match.
-> So, "(\d)+" does not match "abc"
I understand that usually this is not as easy as I write in my simple example because of the power of regular expressions but I think a function like that would improve a lot the error reporting capabilities. Is there any way to do what I need or I must to write my own check function?
That would indeed be useful: actually what we really need is a regular expression debugger, but both need a fully instrumented regex engine to associate states in the machine with characters in the original expression (so you know where the failure occurred).
I'm afraid there's no way to do what you want at present, it's always been on my TO-DO list, but never seems to have surfaced !
John. Does anyone know any application/utility that includes this feature (or a regular expression debugger)? At least this utility would be easier to define (and check) a regular expression against a difficult input.
Thanks anyway,
Jordi
Try 'The Regex Coach' @ http://weitz.de/regex-coach/ - that's my favourite. Built on a Lisp port of PCRE, it uses Lisp's macro feature to build instrumentation into the library. The syntax is different in places to Boost.Regex, but it's close enough for development work. HTH Stuart Dootson