Alternative for positive lookaround/behind
Hey everyone, super new to regex I was trying to do pattern parsing but I think regex is the way to go. Trying to pull out the email name in front of name= and before the @ symbol. When I try to run this "(?<=name=)(.*?)(?=@)" I get a syntax error and reading up it says that positive lookaround isn't supported. Wondering if anyone can help with an alternative to. Here's what the log looks like:
[name=[email protected];mid=282;ip=10.10.10.140;port=55555;ua=zclient/8.7.1_GA_1670;via=148.1.1.1.1.1(ZimbraWebClient - GC96 (Linux)/8.7.1_GA_1670);]
mailop - Adding Message: id=11111111, Message-ID=<000000000000000000000000000.JavaMail.zimbra@dafa.com>, parentId=-1, folderId=5, folderName=Sent.
Appreciate any help. Thank you
Posted Dec 20, 2021, 10:47 PM UTC
I got this to work in regex101. Is this what you were looking for
https://regex101.com/r/BBXPNk/1
That works really well in regex101 actually thank you. But it gives me a make sure that all special characters are escaped error in Loki. How do I also name this variable?
Thanks for the help!
I don't know loki is. I only know what it is in Javascript
const exp = /(?<=name=)[\w]+/igconst matches = "myString".match(exp)Then you can loop through the matches
Cool, this set me in the right direction thank you!
Its worth the pain and sufferings to learn regex. Like you said, you don't want to loops and all that nasty stuff. you can do other really cool things w/ it LIKE upper casing words and making custom labels and what not. Well, have fun