Image for post
Image for post
Photo by Ashkan Forouzani on Unsplash

Regular expressions are used in almost any programming language to match, search, or extract complex or intricate text patterns. A regular expression is a statement in a regular language, a language with a grammar specialized for matching patterns of characters in strings. They come into play in a wide variety of applications. One example is password and naming validation. It’s very likely whatever website you create a new user account on validated your password or username with a regular expression.

One other regular expression operation that’s not talked about as much is replacement. Similarly to matching and searching, replace looks for a pattern to match. However, it then creates a new string that has the matched pattern replaced with a replacement string. The replacement string can be a literal replacement, such as matching [0-9]+ and replacing it with "abc" . Such an operation would convert all digit sequences in a string with the character sequence "abc" . …



Programmer, Artist, Published Author. I’m an engineer on a mission to write the fastest software in the world.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store