3 ms·
Regex libraries often distinguish between a string containing a regex, and matching it. The string "aaaa" is a Regular Expression that describes a language wit
by mcpherrinm 10y ago
Regex libraries often distinguish between a string containing a regex, and matching it.
The string "aaaa" is a Regular Expression that describes a language with exactly one string: "aaaa".
Some regular expression libraries have two operations: They can tell you if a string contains a match somewhere within it, or is exactly a match. Some other libraries only do the first operation, and you need to explicitly ask for "^aaaa$" to get an exact match.
This is one of the things on the differences between the formal definition of a Regular Expression, and a regex library.
- taeric 10y agoYeah. I want trying to be a jerk. Pedantic some, but I thought the difference between match and find was pretty general in regex land.