My Query is simple and my concern is very simple and very new to REGEX. I'm trying to match the records with Double quotes .
Example :
This is my sample Record :
"eventType":"delete","ServerSerial":"1556562030","ServerName":"XYZ_U_O","deletedat":"2018-08-24 17:56:39.974"}
{"eventType":"delete","ServerSerial":"0","ServerName":"","deletedat":"2018-08-24 17:56:34.944"}
First record is valid record with Serverserial and Server Name, But the second record is invalid with 0 as server serial and empty ServerName.
I want to match the second record to eliminate the records . I did try this it is matching both the records.
**^(?=.*?\bdelete\b)(?=.*?\bServerName\b).*$**
With my expertise I couldnt do it . Can anyone help me to resolve this huddle
This will match any line that has a server name of ""
or a server serial of 0
.*(?<=ServerSerial":")0(?=").*|.*(?<=ServerName":")(?=").*
To add this as a full answer..
{"eventType":"delete","ServerSerial":"0","ServerName":""[^}]+},?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.