In normal RegEx \l
will make the character to the right lowercase. However, it seems like the RegEx in Mathematica does not have this functionality.
For example
StringCases["Abba", RegularExpression["(.).*?\\l\\1"]]
will return the following error message
RegularExpression::msg37: "Mathematica does not support \\L, \\l, \\N, \\P, \\p, \\U, \\u, or \\X in RegularExpression[\!\(\"(.).*?\\\\l\\\\1\"\)]."
Is there some workaround that I can use? Note that (?i)
is not sufficient as I need the character to be lowercase only.
Thanks
[a-z]
if ASCII is sufficient ... otherwise it might not be possible to use regexes and you may need to resort to using string patterns with_?LowerCaseQ
which I think will be slower. $\endgroup$\\1
refers to the first byte of the regular expression, which may be also uppercase, but match the lowercase letter at end of the regular expression. $\endgroup$