什么是用于在 Frege 中指定正则表达式文字的重音符号的 unicode 代码?
1 回答
2
该字符称为Acute Accent,其 unicode 为00B4
. 在 ubuntu 中,您可以使用Ctrl++Shift键入,u然后键入00B4
then space。但是,如果您的正则表达式文字不止一个字符,您实际上不必使用它,在这种情况下您可以只使用撇号。
引用文档:
Regular expression literals have type Regex and are written:
´\b(foo|bar)\b´ -- string enclosed in grave accents
'\w+' -- string with length > 1 enclosed in apostrophes
The notation with the apostrophes has been introduced because many have a hard time entering a grave accent mark on their terminal. However, it is not possible to write a regular expressions with length 1 this way, because then the literal gets interpreted as Char literal. (One can write something like '(?:X)' for a Regex that matches a single 'X').
于 2016-08-08T00:45:10.553 回答