klogg
klogg copied to clipboard
regex with quotes
Hi,
I'm looking for a string with quotes with a regular expression but can't get it to work in klogg while I can with grep
grep '\"startdate\" : \"[^\"]' myfile
=> works
In klogg, I tried many syntaxes but can't get one working :
\"startdate\" : \"[^\"]
=> Error in expression: Pattern has unmatched quotes
'\"startdate\" : \"[^\"]'
=> Error in expression: Pattern has unmatched quotes
"startdate" : "[^"]
=> Error in expression: Patterns must be enclosed in quotes
'"startdate" : "[^"]'
=> Error in expression: Patterns must be enclosed in quotes
Trying more things, this one works :
"\"startdate\" : \"\""
but not this one wich is equivalent to the latter
"\"startdate\" : \"[\"]"
Hi, thanks for reporting this. Looks like some qoute escaping parser issue. Does this happen in simple regex mode or in boolean patterns combination mode?
it happens in simple regex mode. Didn't try the boolean mode. As I was trying klogg for the first time (no luck :) ), I don't know it well. I saw in the settings a 'fixed strings' / 'extended regexp' mode. Tried both but same result. That's literally the only thing I tested.
- Opened klogg
- Opened my file
- Tried my regex
- Changed settings for search type
- Tried my regex again
- Filled an issue on GH
What is the state of the button from the screenshot?
This button enables the special mode where you can write combinations of regular expressions, like this "exp1" or "exp2" and not "exp3"
. In this mode each expression has to be surrounded by "
. Your expression then should be like this: "\"startdate\" : \"[^\"]"
For normal regex search it should be unselected. Then the pattern \"startdate\" : \"[^\"]
works as expected.