Match a number between a range


I’m trying to find numbers between 1 and 12. So, the RegEx should find 1, 2, 11, 12 but not 13 and above.

Using [1-12] did not work.

The RegEx should also only find “stand-alone” numbers, e.g. “1 month” or “Buy 2 cars”, but not “CO2 emission”.

The most straightforward regex for your case is:


Use this search <([1-9]|1[0-2])>instead. @VL2D’s regex does not find 10.

Oops, you are right, I did not mention 10. Then, this one:

Thank you, but unfortunately, it does not work as I get an error message when using the RegEx and Power Search:

I cannot imagine why this regex does not work in your Xbench. Mine works properly with the settings on the screenshot.

Please note that you are searching in both source and target simultaneously. This means you are asking Xbench to find all segments where there is a number 1-12 in the source, and simultaneously a number 1-12 (not necessarily the same) in the target.

Try this:
Source: "<([1-9]|10|11|12)=1>"
Target: -<@1>
Search mode: Regular Expressions
PowerSearch: on.