Find all but version number

I have this text

Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

58.0.3029 Copyright 2011 Google Inc.

I want to find everything except

58.0.3029

I use this to find a pattern

\d+(\.\d+\.\d+)

So I have to find everything, but the closest I could do is

[\D+]+([\.\D+][\.\D+])

but it excludes other numbers 5.8 and 2011 which I do not want to do

Can you help me find the right regex for this?

I use http://www.regexpal.com/ for testing

I am using a tool that was developed using C #

+4
source share
3 answers

Use anchors (in multi-line mode):

^\d[\d.]+
# match the start of the line
# require one digit
# followed by digit(s) and dot(s)

And replace the found match with ''. See the demo at regex101.com .

+1
source

, , :

([\s\S]*)\b\d+(?:\.\d+){2,}\s*([\s\S]*)

Regex101

0

, :

([\s\S]*)\b(\d+\.\d+\.\d+)\b([\s\S]*)

: $1$3

Regex101 Demo

:

Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

 Copyright 2011 Google Inc.
0
source

Source: https://habr.com/ru/post/1676678/


All Articles