I want to "translate" a regular expression into a human-readable explanation.
For example: /^[a-z0-9_]{6,18}/
will be translated to something like:
A string start with 6 to 18 char(s) in a range of a to z, 0 to 9 and _.
Most library implementations of regular expressions use a backtracking algorithm that can take an exponential amount of time on some inputs.
They form part of the basic techniques in NLP and learning them will make you a more efficient programmer. Therefore, Regular Expression is one of the key concepts of Natural Language Processing that every NLP expert should be proficient in.
Regular Expressions RE helps us to match or find other strings or sets of strings, using a specialized syntax held in a pattern. Regular expressions are used to search texts in UNIX as well as in MS WORD in identical way. We have various search engines using a number of RE features.
Regular Expressions (Regex) Regular Expression, or regex or regexp in short, is extremely and amazingly powerful in searching and manipulating text strings, particularly in processing text files. One line of regex can easily replace several dozen lines of programming codes.
Expresso, a free tool, does this (and does a good job too).
Expresso 3.0 on Microsoft's regular expression Webcast series
Using RegexBuddy (Paid however in my opinion the best tool available) the expression is documented as below:
// ^[a-z0-9_]{6,18}
//
// Options: ^ and $ match at line breaks
//
// Assert position at the beginning of a line (at beginning of the string or after a line break character) «^»
// Match a single character present in the list below «[a-z0-9_]{6,18}»
// Between 6 and 18 times, as many times as possible, giving back as needed (greedy) «{6,18}»
// A character in the range between “a” and “z” «a-z»
// A character in the range between “0” and “9” «0-9»
// The character “_” «_»
The tool also allows you to select a line in the documentation and showing you the part in the regular expression.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With