首页
\
问答
\
如何在Vim中快速向上和向下重新映射(ctrl u和ctrl d)到ctrl j和ctrl k(How to remap fast up and down (ctrl u and ctrl d) to ctrl j and ctrl k in Vim)
如何在Vim中快速向上和向下重新映射(ctrl u和ctrl d)到ctrl j和ctrl k(How to remap fast up and down (ctrl u and ctrl d) to ctrl j and ctrl k in Vim)
我如何重新映射快速向上和向下命令?
我想将Ctrl-U重新映射到Ctrl-K并将Ctrl-D重新映射到Ctrl-J ?我尝试了以下但没有运气...
nnoremap <c-u> <c-k> nnoremap <c-d> <c-j>
仅供参考 - Vim安装在Ubuntu Server中
How can I remap the fast up and down commands?
I would like to remap Ctrl-U to Ctrl-K and Ctrl-D to Ctrl-J?I tried the following but no luck...
nnoremap <c-u> <c-k> nnoremap <c-d> <c-j>
FYI - Vim is installed in Ubuntu Server
原文:https://stackoverflow.com/questions/33173311
更新时间:2023-09-18 21:09
最满意答案
以特定的正则表达式模式使用以下方法:
s = 'This is an e x a m p l e about T H I S question.' result = re.findall(r'\b((?:\w\s){3,})', s) print(result)
输出:
['e x a m p l e ', 'T H I S ']
Use the following approach with specific regex pattern:
s = 'This is an e x a m p l e about T H I S question.' result = re.findall(r'\b((?:\w\s){3,})', s) print(result)
The output:
['e x a m p l e ', 'T H I S ']
相关问答
更多-
这个怎么样? 这个想法是将最后一组分成两组。 Pattern p = Pattern.compile("(\\w+)=\"([^\"]+)\"|([^\\s]+)"); String test = "a0=d235 a1=2314 com1=\"abcd\" com2=\"a b c d\""; Matcher m = p.matcher(test); while(m.find()){ System.out.print(m.group(1)); System.out.print("=") ...
-
对于PHP我世界推荐这个正则表达式: #^"(\w+) (\w+) (\w+) (?:.+?)","(\d+)\.(\d+)\.(\d+)","(\d+):(\d+):(\d+)"(?:.*?)$#i 和更换模式: $6-$5-$4 ==> $7:$8 $1 $2 $3 我刚在这个网站上测试过它https://ru.functions-online.com/preg_replace.html 我认为将这个php_replace regexp翻译成java regexp并不困难 for php I wor ...
-
因为你的正则表达式中有超过1个捕获组,所以你得到了元组。 请参阅re.findall参考 : 如果模式中存在一个或多个组,则返回组列表 ; 如果模式有多个组,这将是一个元组列表 。 因此,解决方案是仅使用一个捕获组 。 由于你的正则表达式中有令牌,你可以在组内使用它们。 由于只有令牌不同, ([0-9]{4})部分对于两者都是常见的,只需在放入非捕获组的令牌之间使用交替运算符: (?:tokenA|tokenB)([0-9]{4}) ^^^^^^^^^^^^^^^^^ 正则表达式意味着: (?:token ...
-
正则表达式总是贪婪,即使我给它非捕获括号?(Regex is always greedy, even when I give it non-capturing parentheses?)[2023-09-25]
我认为非捕获(?:)会告诉它不要捕获单词标题 非捕获组 仍然使用文本 。 它们只是匹配 (文本被抓取并添加到匹配结果中),不捕获 (=在特定的编号或命名缓冲区中存储匹配值的一部分)。 要检查是否存在,只有外观(或锚点)。 很明显,你想要从匹配中丢弃前缀title : 你不能使用lookbehind,因为在Python re模块中不允许使用可变宽度的 lookbehind(里面有量词的那个)。 通常的解决方法是围绕您需要获取的模式使用捕获组 。 您可以在[\w\s]+子模式周围设置捕获组,以将该值捕获到组1中 ... -
这个正则表达式怎么样? (\d+)([^;]+) 第二组将捕获一个或多个不是分号的字符。 How about this regex?: (\d+)([^;]+) The second group will capture one or more characters that are not semicolons.
-
这是由于全局捕获括号,您应该只捕获所需的两个元素。 import re seq=">Bounded_RNA_of:1DDL:Elength : 1" match = re.search(r'>Bounded_RNA_of:(\w+):(\w)length : 1',seq) print match.group(1), match.group(2) This is due to the global catching parenthesis, you should catch only the two ne ...
-
如果你用一个正则表达式分割一个字符串,你基本上可以知道字符串应该被切割的位置。 这必然会削减你与正则表达式匹配的东西。 这意味着如果你在\w分割,那么每个字符都是一个分割点,它们之间的子串(全部为空)将被返回。 Java会自动删除尾随的空字符串,如文档中所述 。 这也解释了为什么懒匹配\w*? 会给你每个字符,因为它会匹配任何字符(零宽度)之间(和之前和之后)的每个位置。 剩下的是字符串本身的字符。 让我们分解一下: [az] , \w , \w+? 你的字符串是 abcde 比赛如下: a b c ...
-
以特定的正则表达式模式使用以下方法: s = 'This is an e x a m p l e about T H I S question.' result = re.findall(r'\b((?:\w\s){3,})', s) print(result) 输出: ['e x a m p l e ', 'T H I S '] Use the following approach with specific regex pattern: s = 'This is an e x a m p l e ...
-
正则表达式: (^[A-Za-z]{0,3}\d{4,}[A-Za-z]{0,3})(?:$|\s+) \w与[A-Za-z0-9_] ,所以为了匹配字母,你应该使用[A-Za-z] 。 (?:$|\s+)匹配字符串的结尾或至少一个空格(因此忽略字符串的其余部分)。 Regex: (^[A-Za-z]{0,3}\d{4,}[A-Za-z]{0,3})(?:$|\s+) \w is same as [A-Za-z0-9_], so to match just letters you should use [A ...
-
这是一个工作小提琴http://jsfiddle.net/e8tMb/ (如果您对支持嵌套括号的示例感兴趣,我在此答案的底部添加了一个) 这个实现不是纯粹的RegEx,但是,我认为这是非常容易理解的。 它循环遍历字符串,并以非常简单的方式完成您指定的操作。 假设我们有字符串: var str="and something here ( something else here and something else or something else) and something here or somethi ...