我在审查一些代码时在 Ruby 代码中发现了这个正则表达式:/#\s?\z/n
。谁能解释一下正则表达式后的 n
是什么意思?是否可以在正则表达式后放置更多特殊字母?如果是,它们的含义是什么?
最佳答案
Encoding :
Regular expressions are assumed to use the source encoding. This can be overridden with one of the following modifiers.
/pat/u - UTF-8
/pat/e - EUC-JP
/pat/s - Windows-31J
/pat/n - ASCII-8BIT
关于ruby - Ruby 中正则表达式后的字母,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19979742/