0

Okay I'm newbie here... what's the difference between regex and searching algorithms I mean when we use regex and when the othe?

23rd Aug 2019, 2:53 PM
boura hope
boura hope - avatar
2 odpowiedzi
+ 2
Regular expressions are expressions. It's a set of symbols used in a way which can represent the general pattern/form of a string. Regex on itself has little to do with searching for a substring in a string, and is mainly used to describe what a string looks like. Searching algorithms are algorithms used to find a particular object among many other objects. String searching algorithms, in particular, are used to find the location of a specific sequence of characters within a given string. E.g. https://en.m.wikipedia.org/wiki/Boyer%E2%80%93Moore%E2%80%93Horspool_algorithm In programming, regex is commonly used together with string searching algorithms so that programmers can easily identify if a general pattern exists within a string, or if a string conforms to the defined pattern.
23rd Aug 2019, 3:15 PM
Hatsy Rei
Hatsy Rei - avatar
+ 2
A regular expression is not a searching algorithm. It just defines a search pattern, which a searching algorithm can use.
23rd Aug 2019, 3:11 PM
Michael
Michael - avatar