所以我有一些代码通过名单列表(大多数是每行一个用户名)。一些行中有多个名称被“/”字符分解(John Doe / Smith Jr / Some Guy)。我使用以下代码(按名称重复),以便将所有名称修改为正确的LDAP名称。
John Doe
Abraham Lincoln / john_doe
doe john
doe john / Obiwan
john doe / jsmith / mark mane
john smith / john doe
john does
这适用于只有一个名称条目的每个字段。有没有办法指定使用通配符“*”字符删除 John Doe (某些字段可能拼写不正确等),但不要修改任何超过“/”的内容。
示例数据
jdoe
Abraham Lincoln / jdoe
jdoe
jdoe / Obiwan
jdoe / joe smith / mark mane
jsmith / jdoe
jdoe
预期产出
jdoe
jdoe
jdoe
jdoe
jdoe
jsmith
jdoe
我收到的内容
ffprobe -v error -select_streams v:0 -show_entries stream=level -of default=noprint_wrappers=1 <filepath>
答案 0 :(得分:2)
试试这个:
<div>
<PersonsTable aProp={someCoolInfoOrParentState} />
...
</div>
并为该范围内的每个单元格添加一个尾随What:="/*Doe*/", Replacement:="/jdoe/"
,以便捕获/
答案 1 :(得分:2)
这也应该有效,并且不需要任何前缀/后缀。这将在大约6秒内处理100K单元(每次调用foo
函数)。
Sub main()
' This is your main procedure and you can specify all _
of your replacements here on their own line:
Call foo("*Doe*", "jdoe")
Call foo("*Ruth*", "bruth")
Call foo("*Washington*", "gwashington")
' etc...
End Sub
Sub foo(replace, replacement)
Dim rng As Range, cl As Range, vals
Set rng = Worksheets(2).Range("B1:B100000") 'Modify as needed
For Each cl In rng.Cells
vals = Split(cl.Value, " / ")
For i = LBound(vals) To UBound(vals)
If vals(i) Like replace Then
vals(i) = replacement
End If
Next
cl.Value = Join(vals, " / ")
Next
End Sub