We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, is it possible with grok to have the start position of each pattern, to be able to highlight only some portion of string for example?
The text was updated successfully, but these errors were encountered:
It's possible by patching the code.
You have to patch the index.js file. Find the parseSync method and replace it by the following :
index.js
parseSync
function(str) { if (!t.regexp) { t.regexp = new OnigRegExp(t.resolved); } var result = t.regexp.searchSync(str); if(!result) return null; var r = {}; result.forEach(function(item, index) { var field = t.fields[index]; if(field && item.match) { r[field] = item; } }); return r; };
It will return for each key an object lik this:
{ index: 78, start: 41, end: 44, length: 3, match: 'GET' }
where start is the start position, end the end position and match the matched value.
start
end
match
Sorry, something went wrong.
No branches or pull requests
Hi, is it possible with grok to have the start position of each pattern, to be able to highlight only some portion of string for example?
The text was updated successfully, but these errors were encountered: