-11

I'm trying to use the regex module in Python. For example, I have two strings:

Профессиональная ГИС "Панорама" (версия 12.4.0, для платформы "x64")
Профессиональная ГИС "Панорама" (версия 12.4.0, для платформы "x32")

Numbers after 12 are changeable and can be more than two numbers. How can I catch, for example, all first strings?

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123

2 Answers2

0

It is not entirely clear what the conditions are. Based on your comments I think you look for the following regex:

r"Профессиональная ГИС \"Панорама\" \(версия 12(\.\d+){2,}, для платформы \"x(32|64)\"\)"

This will match any sequence of dots and numbers after the 12. (so for instance 12.4.51.3.002 is allowed), and furthermore both x64 and x32 are allowed (not x42).

You can test the regex on regex101.

Willem Van Onsem
  • 321,217
  • 26
  • 295
  • 405
0

You can try the below one. If you have optional numbers after 12, you can include the ? symbol to match the regular expression.

 Профессиональная ГИС "Панорама" \(версия 12.[0-9]?[0-9].[0-9]?[0-9], для платформы "x(32|64)"\)
Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
A user
  • 1,036
  • 3
  • 17
  • 46