Replaced literal brackets with LBRACKET and RBRACKET metacharacters

master
Aadhavan Srinivasan 5 days ago
parent e3b8eaf5f8
commit 125590d334

@ -115,7 +115,7 @@ func range2regex(start int, end int) string {
if startSlc[i] == endSlc[i] { if startSlc[i] == endSlc[i] {
regex += string(rune(startSlc[i] + 48)) // '0' is ascii value 48, 1 is 49 etc. To convert the digit to its character form, we can just add 48. regex += string(rune(startSlc[i] + 48)) // '0' is ascii value 48, 1 is 49 etc. To convert the digit to its character form, we can just add 48.
} else { } else {
regex += fmt.Sprintf("[%c-%c]", rune(startSlc[i]+48), rune(endSlc[i]+48)) regex += fmt.Sprintf("%c%c-%c%c", LBRACKET, rune(startSlc[i]+48), rune(endSlc[i]+48), RBRACKET)
} }
} }
regex += ")" regex += ")"

Loading…
Cancel
Save