+ 6

Understanding the RegEx!

Literal VS Metacharacter VS RegEx Literal: consists of usual words. Ex: "solo" . In this case All the "solo"-s available inside the context will be matched. Metacharacter: are used to specify more general search terms that we would like to identify. Ex: " ^ " metachar is used to specify the start of the sentence. RegEx: is a pattern that the regular expression engine attempts to match in input text. Non-formally speaking : uses metachars and literals to achieve more general search results. Ex: " ^apathy ":In this case, we give more general scope of matching, to match all the lines starting with apathy. Last example to make the difference clear: Ex: flower | ^[Ff]ruit In the example above we have 2 parts seperated by OR(|). The first part is just a literal, the second is a regex. So all the flowers and fruits will be matched, where both the fruits starting with upper and lower case will be matched(as we have [Ff]), but only the ones that are the beginning of a line (as we have ^ metachar) . Let's share more important things connected to RegEx-es in the comments!

5th Apr 2017, 8:44 AM
Gina
Gina - avatar
1 Antwort
+ 1
I sure will. This is the first time I'm understanding regex. Thanks to this: https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions
14th Aug 2018, 5:30 PM
Kustaa