How to write a regular expression with a list of quotes, using raw string literal?

Viewed 33

The main idea of raw string literal, as they wrote here, is to avoid the excessive number of backslases. The main idea of regular expressions is to make a search for substring clear. This is why I use regular expressions and raw string literal. Please help me write a regular expression that contains a list of quotes.

rexp = '\\$\\{[\\\\\\w]+\\(.*\\)\\[["\'`]\\]\\}'
print(rexp, len(rexp))

rexp1 = r'\$\{[\\\w]+\(.*\)\[["\'`]\]\}'
print(rexp1, len(rexp1))
\$\{[\\\w]+\(.*\)\[["'`]\]\} 28
\$\{[\\\w]+\(.*\)\[["\'`]\]\} 29
0 Answers
Related