# Regular expression to find mismatch between source and target for variable type of strings

**URL:** <https://forum.xbench.net/t/regular-expression-to-find-mismatch-between-source-and-target-for-variable-type-of-strings/244>\
**Category:** General Discussion\
**Created:** [May 3, 2017, 4:26am UTC](https://forum.xbench.net/t/regular-expression-to-find-mismatch-between-source-and-target-for-variable-type-of-strings/244 "2017-05-03T04:26:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wit](https://avatars.discourse-cdn.com/v4/letter/w/ee7513/32.png) [@wit](https://forum.xbench.net/u/wit)\
**Post date:** [May 3, 2017, 4:26am UTC](https://forum.xbench.net/t/regular-expression-to-find-mismatch-between-source-and-target-for-variable-type-of-strings/244/1 "2017-05-03T04:26:10Z")

</div>

Hello everyone,

Is there a universal way to find mismatches between source and target for variable type of strings as long as it start with “%”?

For example, I current have a source string:  
Version %1$s of function

and I want to make sure the target also has “%1$s” in it.

I tried the following check and it works:

Source = "%[:digit:]$[:alphanum:]“  
Target = -”%[:digit:]$[:alphanum:]"  
Regular Expression = ON  
PowerSearch = ON

However this is quite restrictive and only works for the case where the variable has four letters: % + digit + $ + alphanumeric. I am wondering if there is a universal check that can pick up any “%” kind of variables, e.g., one check to detect any mismatch between source and target no matter it is “%2”, “%3ss”, “%dd”, “%1$$$”, etc.

Any help would be much appreciated! Many thanks in advance.

---

<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 3, 2017, 7:21am UTC](https://forum.xbench.net/t/regular-expression-to-find-mismatch-between-source-and-target-for-variable-type-of-strings/244/2 "2017-05-03T07:21:59Z")

</div>

The following search should allow you to find all these variables missing in target.

Source: `"(<\%[\$[:alphanum:]]+>)=1"`  
Target: `-<@1>`  
Mode Search: Regular Expressions  
PowerSearch: ON

---

<div class="post-metadata">

**Author:** ![wit](https://avatars.discourse-cdn.com/v4/letter/w/ee7513/32.png) [@wit](https://forum.xbench.net/u/wit)\
**Post date:** [May 3, 2017, 7:50am UTC](https://forum.xbench.net/t/regular-expression-to-find-mismatch-between-source-and-target-for-variable-type-of-strings/244/3 "2017-05-03T07:50:38Z")

</div>

> [@omartin](#):
>
> “(\<%[$[:alphanum:]]+\>)=1”

It works. Thank you so much!
