Okay a bit of a weird one. I know you can do things a bit different and get what you want, but I am just curious whether the functionality exists somewhere or somehow in a single regex line.
Here is a sample expression:
(?s)^\\sqrt[^A-Za-z].*?(\{\\rho\})
^ ^
1 2
Character 1 [^A-Za-z]
is checking for a delimiter.
Character 2 \{
might be that delimiter. It also might be a space, or a ton of other random characters.
However, even if the delimiter is a space, \{
must exist, which means [ {]
is not ideal.
Is it possible to just confirm that the spot filled by character 1 is not a letter, however not have it count as a character? The logic sort of being like;
if ("(?s)^\\sqrt[^A-Za-z]" matches) {
Proceed to evaluate as "(?s)^\\sqrt.*?(\{\\rho\})"
}