更新时间:2022-01-18 21:24:42
使用此正则表达式:
.{3}$
如果您想避免在末尾留空格并可以使用捕获组(您没有精确说明语言或正则表达式的味道),请使用
If you want to avoid spaces at end and can use capturing groups (you didn't precise the language or regex flavour), use
(.{3})\s*$
但是请注意,没有明显的理由在这里使用正则表达式而不是对字符串进行切片.
But note that there's no obvious reason to use a regex here instead of slicing the string.