简体   繁体   English

将“Python 模板字符串”扩展为非 ASCII

[英]Extend “Python Template String” to Non-ASCII

I'm trying to fill values in a formula string by using Python Template Strings .我正在尝试使用Python Template Strings在公式字符串中填充值。 The formula sometimes contains identifiers having non-ASCII characters like α, ß, Γ etc. (see Unicode Greek and Coptic Chart ) .该公式有时包含具有非 ASCII 字符的标识符,如 α、ß、Γ 等(请参阅Unicode 希腊语和科普特图表 But as per python documentation, the template string is limited to only ASCII identifiers.但根据 python 文档,模板字符串仅限于 ASCII 标识符。 The default regular expression to match the identifier is (?a:[_a-z][_a-z0-9]*) .匹配标识符的默认正则表达式是(?a:[_a-z][_a-z0-9]*)

How can I extend the default regular expression so it also matches the characters from Unicode Greek and Coptic Chart ?如何扩展默认正则表达式,使其也匹配来自Unicode Greek 和 Coptic Chart的字符?

I'm trying to fill values in a formula string by using Python Template Strings .我正在尝试使用Python Template Strings在公式字符串中填充值。 The formula sometimes contains identifiers having non-ASCII characters like α, ß, Γ etc. (see Unicode Greek and Coptic Chart ) .该公式有时包含具有非 ASCII 字符的标识符,如 α、ß、Γ 等(请参阅Unicode 希腊语和科普特图表 But as per python documentation, the template string is limited to only ASCII identifiers.但根据 python 文档,模板字符串仅限于 ASCII 标识符。 The default regular expression to match the identifier is (?a:[_a-z][_a-z0-9]*) .匹配标识符的默认正则表达式是(?a:[_a-z][_a-z0-9]*)

How can I extend the default regular expression so it also matches the characters from Unicode Greek and Coptic Chart ?如何扩展默认正则表达式,使其也匹配来自Unicode Greek 和 Coptic Chart的字符?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM