Menu

#283 Support for function callouts

open
nobody
None
5
2010-09-08
2010-09-08
No

I would like to suggest function callouts as a new feature, similar to the callout feature provided by PCRE.
In PCRE, special character sequences (?Cd), where d is any integer <= 255, can be used in the regular
expression to indicate callout points. When the point is reached during matching, a global callout function,
which can be defined by the user, is called with d as parameter. The current match state, groups matched so far etc.
are passed to the function as arguments. The matching process continues when the function returns 0,
and it is terminated otherwise.

The PCRE definition could even be extended:
- Use specific callout functions (e.g. defined at the time when the regex is compiled) rather than a global one
- Allow the callout function to modify the matching state, e.g. to continue the matching process at a different position
in the string

This would allow regular expression matching to be combined e.g. with dictionary lookups or any kind of non-regular
post-checking of parts of the match.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.