ApSIC Xbench Forum

Issue creating Checklist item with expressions


I am having some trouble developing a RegEx to create checklist item to check for a specific issue.

In the project I’m handling there are some variables that may appear once in a string or a couple of times. Therefore, I would need Xbench to check if the amount of times the variable appears in the source matches in the target as well.


<a:m> suffered at the hands of <b:m>. <a:m> then departed to hunt down <b:m>.

In this example, I would need Xbench to check whether <b:m> and <a:m> variables appear twice each in the Target text.

According to this post I understand the best way to set up this check with the checklist manager would be to use the @ expressions function and have a checklist item per variable. However, I have tried without success both with this function and with normal RegEx, but to no avail.

Some examples I tried to make it work:

Source: “[\<b:m\>]{2,}”
Target: -"[\<b:m\>]{2,}"
Mode Search: Regular Expressions
PowerSearch: ON

Source: “(\<b:m\>)=1([\<b:m\>]{2,})=2”
Target: -"@1" or -"@2"
Mode Search: Regular Expressions
PowerSearch: ON

Would someone be able to help me out?

Many thanks in advance!


Could you please provide some source and target samples?


Hi Oscar,

Of course! You can find them below:

Source: A Walker!
Target: ¡$gUn:Una; Caminante!

Source: Guards! The outsider is here!
Target: ¡Guardias! ¡$gEl forastero:La forastera; está aquí!

Source: I’m so happy you made it back safely!
Target: ¡Me alegro de que hayas vuelto $gsano y salvo:sana y salva;!

As you can see, the variable can break in several different ways:

  • With a space between the $ and the g
  • With a space between the $g and the first word
  • With a space between the words and the colon ( : )
  • With a space between the last word and the semicolon ( ; )
  • By not having the ending semicolon ( ; )

Furthermore, as you can see, the variable for gender accepts more than one word inside, as seen in the 2nd and 3rd example.

In the end I just need to check if the tag is broken in the Target text, though.

Thanks in advance for your help!


Hi Jesús,

The following search should detect all possible cases:

Target: \$[:space:]*g (\$[:space:]+g OR \$g[:space:]+ OR \$g[^\:]+[:space:]+\: OR \$g[^\:]+\:[:space:]+ OR \$g[^\:]+\:[^;]+[:space:]+; OR \$g[^\:]+\:[^;]+$)

Search mode: Regular Expressions
PowerSearch: On


Hi Oscar!

Thank you so much for your reply, and my apologies for my delayed response.

I confirm that it looks to be working just fine, but I found another possible way for the variable to break. You can find the example below:

Source: If you return when you are wiser, I will regale you with tales of great heroics.
Target: Si vuelves cuando estés más preparado:preparada;, te deleitaré con historias de grandes proezas.

As you can see, in this case we are missing $g altogether. As with the examples provided in my previous message, in this case ($g missing altogether), we could also have more than 1 word before and after the colon.

What would be the updated search that takes this case into account, as well as the others?

Many thanks in advance!


The easiest way to detect these cases would be the following search:

Target: "[:letter:]+\:[:letter:]+[:space:]?[:letter:]+;" -"\$g"
Search mode: Regex.
PowerSearch: On.

This search works if there should be only one $g instance.