Regex for numbers, not covering dates

Dear regex friends

I am looking for a regular expression to cover 100 or 100.000 and 5.123.895 or 12.588,9 but NOT 09.07.2016 or 11.09.2001

For my current knowledge it is impossible. I can of course find 5.123.895 with \d+\.\d{3}\.\d{3} and so on, but this means quite number of searches. Not really so big deal, but nonetheless having something giving me that with simpler means, my life would be easier.


Many thanks in advance and best regards, Jerzy

_________________________________________________________

When asking for help here, please be as accurate as possible. Please always remember to give the exact version of product used and all possible error messages received. The better you describe your problem, the better help you will get.

Want to learn more about Trados Studio? Visit the Community Hub. Have a good idea to make Trados Studio better? Publish it here.

Parents
  • Hi Jerzy,

    Let me know if this regex covers all the possibilities for you:

    \d{1,3}[\.]*[\d{3}\.]*[\d{3}]*[,\d+]*

    ... Jesús Prieto ...

  • Hi Jesus

    Many thanks for your efforts and the willingness to help.

    Unfortunalety it does not do, what I would need. Here is an example text:

    Die Schlacht um Midway fan vom 04.06.1942 bis zum 07.06.1942 statt.
    Der als "Doolitle Raid" bekannte amerikanische Luftangriff wurde am 18.04.1942 geflogen.Die für den preußischen Kreuzritterorden vernichtende Schlacht bei Tannenberg (zu Polnisch "Grunwald) wurde am 14/07/1410 geschlagen.

    Das deutsche Schlachtschiff „Bismarck“ war eines der schlagstärksten Schiffe seiner Zeit. Mit einer Verdrängung von maximal 53.500 Tonnen und einer Leistung von 150.170 PS (110.450 kW) erreichte es eine Geschwindigkeit von 30,6 Knoten, was 57 km/h entspricht. Seine Besatzung zählte 2.092 Mann. Der Stapellauf fand am 14. Februar 1939 statt. Allerdings galt das Schiff erst ab 1941 einsatzbereit.
    Im Rahmen der Operation „Unternehmen Rheinübung“ sollte es mit der Prinz Eugen durch die britische Blockade auf den Atlantik gelangen und dort gegen alliierte Konvois eingesetzt werden. Im Zuge dieser Operation kam es zu einer großen Verfolgungsjagd. Die beiden Schiffe brachen in Begleitung zahlreicher kleineren Einheiten am 18. Mai 1941 aus Gdingen (damals Gotenhafen) mit dem Ziel Atlantik aus. Der deutsche Verband wurde am 21. Mai 1941 von den Briten gesichtet. Am 24.05.1941 kam es zum „Gefecht in der Dänemarkstraße“, bei dem das britische Schlachtschiff durch das Feuer der Bismarck um 06:01:00 Uhr versenkt wurde. Dadurch konnten Bismarck und Prinz Eugen entkommen.
    Im Zuge weiterer Verfolgung wurde die Bismarck letztendlich gestellt und am 27.Mai 1941 versenkt.

    Die Supermarine Spitfire zählt zu den bekanntesten Flugzeugen des Zweiten Weltkriegs. Von dem Muster, dessen Erstflug am 6.3.1938 stattfand, wurden insgesamt 20.351 Exemplare gebaut. Der Preis für eine voll ausgerüstete Spitfire betrug £ 12.604,00 im Jahre 1939, was heute etwa 580.000,00 Pfund entspricht.
    Ihre Bewaffnung bestand je nach Modell aus acht Maschinengewähren Kaliber 7,7 mm oder vier Maschinengewähren vom gleichen Kaliber und zwei Kanonen Kaliber 20,00 mm.
    Die Dienstgipfelhöhe betrug je nach Modell zwischen 9400 und 13600 m.

    Unser Regex-Seminar findet am 09.07.16 statt.

    And this is, what the Regex does pick up:

    Best regards, Jerzy

    _________________________________________________________

    When asking for help here, please be as accurate as possible. Please always remember to give the exact version of product used and all possible error messages received. The better you describe your problem, the better help you will get.

    Want to learn more about Trados Studio? Visit the Community Hub. Have a good idea to make Trados Studio better? Publish it here.

  • Hi Jerzy,

    I tried a few things. The following is the closest I could get before my brain stopped working...

    (\s|\()(?!\d{1,2}\.\d{1,2}\.\d{4})(?!\d{2}/|\d{2}:)\d+\.?\d*\.?,?\d*

     Let me know how it works.

    Depending on the flavor of regex, you may need to escape the slash:

    (\s|\()(?!\d{1,2}\.\d{1,2}\.\d{4})(?!\d{2}\/|\d{2}:)\d+\.?\d*\.?,?\d*




    (?!\d{1,2}\.\d{1,2}\.\d{4}) 

     The main point is the negative lookahead, which says not to match this regex, such as 04.06.1942 in your example.

    https://regex101.com/r/bL4jW4/1

  • Thank you, will test it later.
    The point with negative lookups is still something I need to learn. I've made a decent progress in understanding the Regex, nonetheless I am still a bloody beginner.
    Best regards, Jerzy

    _________________________________________________________

    When asking for help here, please be as accurate as possible. Please always remember to give the exact version of product used and all possible error messages received. The better you describe your problem, the better help you will get.

    Want to learn more about Trados Studio? Visit the Community Hub. Have a good idea to make Trados Studio better? Publish it here.

Reply Children