How to search for the Years (Dates) with different expression styles?

Dear Sirs,

In my country, we use different expression styles for Year when translating the A.D. years.

The rule looks like this:

A.D. 2020.12.21 = 109.12.21
(YYYY.MM.DD)

Basically speaking, to convert any Gregorian calendar year (1912 and after) to our calendar, all you have to do is subtract 1911.

Therefore, I would like to compose the expression in order to search for the translations which do not follow the rule mentioned above.

Please refer to the picture below for your reference.

As you can see, I broke the date into five parts.

Column B and D are both fixed, or may be replaced by a slash (/).

Column A, C, and E are variable.


  • “Column A” will be the Year; however, the number must be subtracted 1911 in order to fit the correct format.
    (Mismatch: The number that does not subtract 1911)

  • “Column C” will be the Month, the range is from 01 to 12.
    (Mismatch: The number that does not fit the number in source)

  • “Column E” will be the Day, the range is from 01 to 31.
    (Mismatch: The number that does not fit the number in source)


Is it possible to compose an expression or multi expressions for Xbench to search for the numbers which do not follow the rules I mentioned above? :worried:

Xbench does not perform numbers operations or conversions.
If the only difference between the Gregorian calendar and yours is the year, the solution would be to create a checklist entry for each year that appears on the source text:

For instance, to check 2020 dates, the checklist entry would look like the following:

Source: "2020(\.[0-9]{,2}\.[0-9]{,2})=1"
Target: -"109@1>"
PowerSearch: On.
Search mode: Regular Expressions.

Once created at the Checklist Manager, you can copy and paste this entry to clone the entry and modify to check another year.

Hi omartin,

Understood, I just use your formula, and it works perfectly!!! :smiley:

I appreciate for your kindly support every time, and my appreciation goes beyond words. :+1:

Hi omartin,

May I ask one more question, please?

What if the source is “2020/12/21” or “2020-12-21” instead of “2020.12.21”?

Can I use this one:

“2020(/[0-9]{,2}/[0-9]{,2})=1”

or

“2020(-[0-9]{,2}-[0-9]{,2})=1”

Thanks in advance.

If the source format changes to 2020/12/21 for instance but target uses dot as separator, use this one:

Source: "2020/([0-9]{,2})=1/([0-9]{,2})=2"
Target: -"109\.@1\.@2>"
Search mode: Regular Expressions
PowerSearch: On.

If the separator is not the same in source and target, month and day have to be stored in different variables.

If the separator in source is -, the source would be "2020-([0-9]{,2})=1-([0-9]{,2})=2".

If date format in source is not YYYY/MM/DD but DD/MM/YYYY, then the search would be the following:

Source: "([0-9]{,2})=1/([0-9]{,2})=2/2020"
Target: -"109\.@2\.@1>"
Search mode: Regular Expressions
PowerSearch: On.

Hope this helps.

Òscar.

1 Like

Hi Òscar,

I really appreciate it!!! :100:

The expressions you offered work perfectly! :smiley:

Andy