我想将正则表达式“翻译”成人类可读的解释。
例如:/^[a-z0-9_]{6,18}/
将被翻译为:
A string start with 6 to 18 char(s) in a range of a to z, 0 to 9 and _.
答案 0 :(得分:3)
Expresso,一个免费的工具,这样做(也做得很好)。
Expresso 3.0 on Microsoft's regular expression Webcast series
答案 1 :(得分:3)
使用RegexBuddy(但在我看来是付费的最佳工具),表达式记录如下:
// ^[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 “_” «_»
该工具还允许您在文档中选择一行,并在正则表达式中显示该部分。