You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Nintex工作流中Regex Action仅替换首个匹配项的实现方法

Fixing the First-Only Regex Replacement in Nintex Workflow 2013

Got it, let's sort this out for you. The issue right now is that your regex \) is matching every closing parenthesis in the string, which is why both the one after "W" and the one in "(comments)" are getting replaced.

Here are two solid ways to only remove the first closing parenthesis:

Option 1: Use a Non-Greedy Capture Group (Works if you don't have a "replace count" setting)

Adjust your regex pattern to target only the first occurrence by capturing everything up to that first ) and discarding the parenthesis itself:

  • Pattern: ^(.*?)\)
  • Replacement text: $1

How this works:

  • ^ anchors the match to the start of the string (so we don't accidentally grab a later parenthesis first)
  • .*? is a non-greedy match—it grabs as few characters as possible until it hits the first )
  • \) matches that first closing parenthesis
  • $1 in the replacement inserts everything we captured before that first ) (effectively removing just that one parenthesis)

Testing this with your input:

Input: Douglas Christopher W) I have some (comments) to add.
Result: Douglas Christopher W I have some (comments) to add.

Option 2: Use Nintex's Replacement Count Setting (If Available)

Some versions of Nintex Workflow's Regular Expressions Action include a "Number of replacements" field. If you see this:

  • Keep your original pattern \)
  • Set the number of replacements to 1
  • Leave replacement text empty

This tells the action to only replace the first match it finds, no regex tweaks needed.

Either approach will get you the result you want—pick whichever fits your Nintex setup best!

内容的提问来源于stack exchange,提问作者CigarDoug

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 06:38:53