📜 ⬆️ ⬇️

Introduction

I was surprised not to find a similar blog on Habré. Nothing, try to fill this gap. In this blog, I plan as simple as possible to describe the work of regular expressions, more inclined to complete the analysis of frequently used examples. Also, in the plans, to tell about the features of different expression engines, and their implementation in popular programming languages.

To begin with, let's talk about what regular expressions are and what their practical application is.

Regular expressions - what is it?


I will quote Wikipedia:
Regular expressions are a system for parsing text fragments in a formalized pattern, based on a system for recording patterns for searching.

Simply put, regular expressions are certain patterns by which you can check, change, or search for anything in any textual data. For example, you can check the validity of email, replace some words with others (let's say for spelling text), parse some rather complex content, and so on.
')

Regular expressions in practice


In fact, the regexps (jargon) may seem somewhat esoteric to you, but if you own them, you can shorten the time by several times.

Quite often I have to work with text, in particular with validation and parsing. Previously, it was necessary to use the standard functions of the language for working with text, to write the logic itself. Now, after I delved into regexps, all the work was reduced to writing a couple of lines.

Regexps are very relevant for data validation. In the next topic, I plan to consider email validation as the most popular example of use.

P. S. PPNH.
P. P. S. If you are interested, throw tasks to work with the text, perhaps there will be topics with a description of their solution.

Source: https://habr.com/ru/post/55755/


All Articles