简体   繁体   English

弗雷格的正则表达式文字

[英]Regex literal in Frege

在Frege中用于指定正则表达式文字的重音符号的unicode代码是什么?

The character is called Acute Accent and the unicode for that is 00B4 . 该字符称为“ 急性口音” ,其Unicode为00B4 In ubuntu, you can type that using Ctrl + Shift + u and then type 00B4 then space . 在ubuntu中,您可以使用Ctrl + Shift + u键入该00B4 ,然后键入00B4然后输入space However you don't really have to use that if your regex literal is more than one character in which case you can just use apostrophes. 但是,如果您的正则表达式文字不止一个字符,则不必真正使用该字符,在这种情况下,您只需使用撇号即可。

Quoting the doc : 引用文档

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').

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

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