re: Do we need Regex? VIEW POST


Besides the implementation in codes even you don't want to use it in your implementation.

Regular Expressions are really powerful tools to improve your productivity such as refactoring, some conditional searching, and replacing.

My quick suggestion in implementation is it depends on how complicate of the value you want to replace or matching for instants you want to take some part of the string and capture it to variable

validation status is 12044,  and value is \"Lazy fox jumping\"
                     ^^^^^^ want this     ^^^^^^^^^^^^^^^^^^ and want this

with traditional looping will cause extra logic to extract data from the input and harder to maintain but with Regular Expressions, it would be easier with capturing group like

.*([0-9]{5}).*"([a-zA-Z\s].*)"$ demo

but at the end of the day, it depends on the developer who maintains the project to decide this!

code of conduct - report abuse