# Regex for segments with multiple variables

**URL:** <https://forum.xbench.net/t/regex-for-segments-with-multiple-variables/794>\
**Category:** Technical Support\
**Created:** [May 24, 2021, 10:10am UTC](https://forum.xbench.net/t/regex-for-segments-with-multiple-variables/794 "2021-05-24T10:10:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trandre](https://avatars.discourse-cdn.com/v4/letter/t/58f4c7/32.png) [@Trandre](https://forum.xbench.net/u/Trandre)\
**Post date:** [May 24, 2021, 10:10am UTC](https://forum.xbench.net/t/regex-for-segments-with-multiple-variables/794/1 "2021-05-24T10:10:44Z")

</div>

Hello,

I have been using this forum as an inspiration to use RegEx on Xbench and it solved so many problems already, but I didn’t manage to create a search for segments in the source that have more than one variable in this form: `${variableText}`

With this one I was able to detect segments with one occurency:

Source: `"(\$\{[^\}]+\})=1"`  
Target: `-@1`  
Powersearch: On.  
Search mode: Regular Expressions.

I didn’t find the correct syntax to add another variable “2” in order to flag segments with 2 ${variableText}, where one, or more, are not matched in target.

Thank you very much in advance for the great support! 🙂

Andrea

---

<div class="post-metadata">

**Author:** ![omartin](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.xbench.net/omartin/32/82_2.png) [@omartin](https://forum.xbench.net/u/omartin)\
**Post date:** [May 24, 2021, 1:21pm UTC](https://forum.xbench.net/t/regex-for-segments-with-multiple-variables/794/2 "2021-05-24T13:21:55Z")

</div>

It is necessary to create several checklist entries to detect segments with more than 1 occurrency.

For instance, to detect segments with two variables in source but one missing in target, you would use the following one:

Source: `"(\$\{[^\}]+\})=1\$*(\$\{[^\}]+\})=2"`  
Target: `-@1 OR -@2`  
Powersearch: On.  
Search mode: Regular Expressions.
