[Cialug] Regex Question
Andy Denner
linux-list at upeke.com
Sat Jul 30 19:48:35 UTC 2022
Regex for Json is only marginally better than using it to parse HTML
(see
https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454)
. I agree that I would either use jq or a quick python script.
Scott Yates wrote on 7/25/2022 10:39 AM:
> Yes, regex is probably not the right tool for that. jq would be better, or
> even just a little script, but trying to parse json with regex is asking
> for serious headaches.
>
> On Mon, Jul 25, 2022 at 10:18 AM Will <staticphantom at gmail.com> wrote:
>
>> I wouldn't use regex for this but I would use jq and pluck the fields you
>> want. Alternatively use grep -v and omit the line command line.
>>
>> -Will C
>>
>> On Mon, Jul 25, 2022, 11:15 Todd Walton <tdwalton at gmail.com> wrote:
>>
>>> Let's say I have a block of text like this:
>>>
>>> ===================================
>>> {
>>> "altGrAliasing": true,
>>> "antialiasingMode": "grayscale",
>>> "closeOnExit": "graceful",
>>> "colorScheme": "Campbell",
>>> "commandline":
>>>
>>>
>> "C:\\Users\\seven\\AppData\\Roaming\\Scoop\\apps\\msys2\\current\\msys2_shell.cmd
>>> -defterm -here -no-start -msys",
>>> "cursorShape": "bar",
>>> },
>>> ===================================
>>>
>>> How do I write a regex to match all lines *except* the "commandline"
>> line?
>>> --
>>> Todd
>>> _______________________________________________
>>> Cialug mailing list
>>> Cialug at cialug.org
>>> https://www.cialug.org/cgi-bin/mailman/listinfo/cialug
>>>
>> _______________________________________________
>> Cialug mailing list
>> Cialug at cialug.org
>> https://www.cialug.org/cgi-bin/mailman/listinfo/cialug
>>
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> https://www.cialug.org/cgi-bin/mailman/listinfo/cialug
More information about the Cialug
mailing list