简体   繁体   English

GoogleDocs搜索和替换中的正则表达式

[英]Regex in GoogleDocs search-and-replace

I want to replace all first "/" with "[" but all second "/" with "]". 我想用“ [”替换所有第一个“ /”,而用“]”替换所有第二个“ /”。 GoogleDocs offers a regular expression search-and-replace, but I have no clue how to use that for this "first and second" issue. GoogleDocs提供了一个正则表达式搜索和替换,但是我不知道如何将其用于此“第一和第二”问题。 Example of source and target below. 下面是源和目标的示例。

What do I have to enter in the Search and Replace fields of GoogleDocs dialogue? 我必须在GoogleDocs对话框的“搜索和替换”字段中输入什么?

current state 当前状态

p pen /pen/
b bad /bæd/
t tea /tiː/

intended solution 预期的解决方案

p pen [pen]
b bad [bæd]
t tea [tiː]

In Google Sheets you can use capture groups so you could do something like Find: /(.*)/ Replace with: [$1] 在Google表格中,您可以使用捕获组,因此可以执行以下操作:查找:/(.*)/替换为:[$ 1]

Docs does not support this functionality so you may have to move your stuff around a little. Google文档不支持此功能,因此您可能需要稍微移动一下内容。

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

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