How to find a string next to a specific string

I need to extract a specific information from the text messages below. It is “7.3.0.1.3” which is next to “Version”.
I think if I use ‘awk’ or ‘Regex’, I could get it but I was wondering if there is another simple way by handling text strings.

Do you have an idea?


    software Command Interpreter
    Version 7.3.0.1.3 Linux 0_PLATFORMS_231312.1925.2_FBO
    Linux, x64, 64bit (optimized), first on Nov 11 2015 01:38:14
    Operating system character set identified as UTF-8.

With RegEx: Version\\s([0-9\\.]*)\\s
The version number will be in sub expression 1 :slight_smile:

Input strings have 4 lines so I need to handle more if I use Split.
I think I should take RegEx approach. It works !!

Thank You!

Added:


Dim rg as New RegEx
Dim myMatch as RegExMatch

inputString = BufferString
rg.SearchPattern = "Version\\s([0-9\\.]*)\\s"
myMatch=rg.search(inputString)

If myMatch<>nil Then
  version=myMatch.subExpressionString(1)
End If

Using Tim’s suggestion as a starting point, I came up with this:

(?<=\\bVersion\\x20)[\\d.]+

Since this uses a positive lookbehind to confirm the leading string, the entire match will be the version number (no subexpressions).

This is meant as informative only, since there is no real reason to change it.

Simpler. Beautiful.

Thank you!