ApSIC Xbench Forum

Tag order: opening tag before closing tag

The following regular expression with PowerSearch allows to find those segments where the closing tag has been inserted before the opening tag in target.

1 Like

Hi Òscar, thank you for the tip. What if I need to check the tag order in the following mxliff file containing subtitles:

The tags here are subtitle tags that indicate the number and time of subtitles, so their order must not be changed. In the sentence in the image, the order has been changed and I would like to be able to catch this type of error in Xbench. Would it be possible? Thank you!

Then, you must create a checklist entry depending on the number of tags. For instance, to check the order of segments with 5 tags, I would use the following search:

Source:"^.+(\<[^\>]+\>)=1.+(\<[^\>]+\>)=2.+(\<[^\>]+\>)=3.+(\<[^\>]+\>)=4.+(\<[^\>]+\>)=5.+$"
Target: -"^.+@1.+@2.+@3.+@4.+@5"
Search mode: Regex
PowerSearch: On.

Thank you for your prompt reply! Unfortunately, I tried the checklist you suggested with the file I showed you above but no errors are found, although the error is there. Any alternatives? This is how those tags appear in Xbench search:

I need to check that the tag numbers follow the cardinal numbers order, i.e. they are in ascending order.

Try changing the source term to the following one:

"^.*(\<[^\>]+\>)=1.*(\<[^\>]+\>)=2.*(\<[^\>]+\>)=3.*(\<[^\>]+\>)=4.*(\<[^\>]+\>)=5.*$"

I tried, but now it seems to find all segments with 5 tags, both with correct and incorrect order indifferently.

Maybe this one should help:

"^[^\<]*(\<[^\>]+\>)=1[^\<]*(\<[^\>]+\>)=2[^\<]*(\<[^\>]+\>)=3[^\<]*(\<[^\>]+\>)=4[^\<]*(\<[^\>]+\>)=5[^\<]*$"

Again, it seems to find segments wit 5 tags, both with correct and incorrect order.

The problem is in target. You should not start it with .+ because you are excluding any segments starting with a tag (notices that those shown in your screenshot start all with a tag).

In addition you want to replace the plus signs with asterisk, so that you can support the case where two tags are placed next to each other.