Regex search #450
-
Hi, I tried different combination but was unable to get my commands working. I am trying to extract all similar strings from a large archives of logs "field1\":\"1111111111111111\",\"field2\":\"2222222222222222\" This is the command that I ran ugrep on Windows .\ugrep.exe -oirIz --sort=name --stats '{"field1":"[0-9]+","field2":"[0-9]+",' E:\Logs Searched 2500 files in 1 directory in 51.9 seconds with 7 threads: 0 matching (0%) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Beta Was this translation helpful? Give feedback.
-
Not sure what you mean. The regex works fine with ugrep. Just make sure you use single $ echo '"field1":"1111111111111111","field2":"2222222222222222"' | ug '"field1":"\d{16}","field2":"\d{16}"'
1: "field1":"1111111111111111","field2":"2222222222222222" Note that your regex |
Beta Was this translation helpful? Give feedback.
Not sure what you mean. The regex works fine with ugrep. Just make sure you use single
'
-quotes for the regex pattern and you don't need to escape"
with\"
when running theug
command in a shell e.g. in bash. For example, here I'm usingecho
to show thatug
finds the full matching pattern as expected:Note that your regex
("field1\":\"\d{16})\",\"field2\":\"\d{16}\*"
has extra ( and ), why is that?