Skip to content
New issue

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

replace eval function uses java regex syntax instead of pcre2 #386

Open
kortemik opened this issue Oct 22, 2024 · 1 comment
Open

replace eval function uses java regex syntax instead of pcre2 #386

kortemik opened this issue Oct 22, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@kortemik
Copy link
Member

kortemik commented Oct 22, 2024

Describe the bug
replace eval function uses java regex syntax instead of pcre2

following can be used in pcre2 syntax to match for literal characters ] and [ at the beginning of the line

(^[][])

however for java syntax it is incorrect and requires escaping as follows

(^[\]\[])

Expected behavior
pcre2 syntax is supported for replace eval function while java is supported with a to-be-implemented replace4j function.

How to reproduce

use pcre2 syntax in following query is not working:

|makeresults count=1 | eval value="[" | eval value = replace(value, "(^[][])", "X")

gives

Unclosed character class near index 6
(^[][])
      ^

Screenshots

Software version
pth_07 7.2.4

Desktop (please complete the following information if relevant):

  • OS:
  • Browser:
  • Version:

Additional context

use of java syntax:

|makeresults count=1 | eval value="[" | eval value = replace(value, "(^[\]\[])", "X")

replaces correctly

Teragrep

_time	value
2024-10-22T16:13:41.000+03:00	X
@kortemik kortemik added the bug Something isn't working label Oct 22, 2024
@Abigael-JT
Copy link
Contributor

Substitute support to be added to JavaPcre library #33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants