Reputation: 15
Why this doesn't works
local filepath = "Name : Java DB 10.5.3.0 Vendor : Sun Microsystems, Inc Install Date : 20110429 Version : 10.5.3.0"
local name,vendor,installdate, version = string.find(filepath,"^Name : (.*?) Vendor : (.*?) Install Date : (.*) Version : (.*)$")
print(name)
print(vendor)
print(installdate)
print (version )
Need to break the string using Regex:-
I have a string below
"Name : Java DB 10.5.3.0 Vendor : Sun Microsystems, Inc Install Date : 20110429 Version : 10.5.3.0"
I need to get the Vendor :Sun Microsystems, Inc
I need to get the Install Date :20110429
I need to get the Version :10.5.3.0
Input string to Regex
local strname = "Name : Java DB 10.5.3.0 Vendor : Sun Microsystems, Inc Install Date : 20110429 Version : 10.5.3.0 "
output string
Name :Java DB 10.5.3.0
Vendor :Sun Microsystems, Inc
Install Date :20110429
Version :10.5.3.0
Upvotes: 1
Views: 134
Reputation: 2346
Well, I don't understand Your output, but the following regex may be a start on what You might want. Visualized here
^Name : (.*?) Vendor : (.*?) Install Date : (.*?) Version : (.*?)$
Upvotes: 1