Sunday, February 10, 2019

hiring great software engineers that know regex is important

There is an old joke… The manager tells all the developers they need to come in at 9 am, take lunch at noon, and leave by 6 pm. Half the developers quit and productivity drops to almost zero. The manager then says come and go as you like. The developers show up at noon, work until 3 am, productivity skyrockets. The joke is, it is no joke.

I hate PHP. I hate Symfony.
It's a great thing though that you write strings for different languages/locales in yml files similar to the strings.yml used in Android apps.

I came across a bug in my code leading to failure in compilation/rendering.
The cause was unescaped "unquoted" strings inside the yml file.

such as
variable:"message in a "box""

correct way to use is
variable:"message in a \"box\""

I spent time trying to find a regular expression to detect such cases.

Here it is: 
((?<![\\])['"])((?:.(?!(?<![\\])\1))*.?)\1

Reference:
https://www.metaltoad.com/blog/regex-quoted-string-escapable-quotes

No comments:

Post a Comment

Going one step further with Kotlin & gRPC

Recently, I tried using Quarkus with Kotlin for grpc. I have worked with grpc for communication between microservices in Java & Golang. ...