Log Surgeon
Test & API docs
Loading...
Searching...
No Matches
Buffer parser using variables with capture groups.

Tests BufferParser behavior with named capture groups in variable schemas. More...

Functions

void single_line_with_capture ()
 Validates tokenization behavior when using capture groups in variable schemas.

Detailed Description

Tests BufferParser behavior with named capture groups in variable schemas.

Verifies:

  • Symbol registration for variables and capture groups
  • Correct association of tag positions
  • Proper assignment and lookup of tag registers

Useful for validating advanced schema features like (?<name>...) integration.

See also
Buffer parser using variables without capture groups. for simpler variable matching.

Function Documentation

◆ single_line_with_capture()

void single_line_with_capture ( )

Validates tokenization behavior when using capture groups in variable schemas.

This test verifies the BufferParser's ability to:

  • Recognize a variable definition containing a named capture group.
  • Identify and register both the variable name and the capture group name as valid symbols.
  • Link the capture group to its associated tag IDs and registers.
  • Extract matched positions correctly when parsing a token.
  • Fail to match tokens that don't align exactly with the specified capture pattern.

Schema Definition

delimiters: \n\r\[:,
myVar:userID=(?<uid>123)

Test Input

"userID=123 userID=234 userID=123 123 userID=123"

Expected Logtype

"userID=<uid> userID=234 userID=<uid> 123 userID=<uid>"

Expected Tokenization

"userID=123" -> "myVar" with "123" -> "uid"
" userID=234" -> uncaught string
" userID=123" -> "myVar" with "123" -> "uid"
" 123" -> uncaught string
" userID=123" -> "myVar" with "123" -> "uid"