How can we get the numbers 7 and 4 and 5 from the following string:
MODULE potmtpMAIN main <info: "Enterprise Optimizer 7.4 for COR Technology 5.5 --
Advanced Solver Edition", url:"http://EO.riverlogic.com", url_menu:"EO Online...",
app_id:"EOAS",app_name:"Enterprise Optimizer AS", app_major:7,
app_minor:4,app_micro:5,app_copyright:"\251 1996-2010 River Logic Inc.\r\nAll
Rights Reserved.">
The search must be based on app_major: app_minor: and app_micro
Thank You in advance
Here is a simple regex to pick out each part, with example code for someone unfamiliar with regular expressions in .NET: (Edited, since the original question was edited to remove the asterisks).
You could just use 3 different expressions, one for each part you want to pick out of the string.
Explanation:
(?<=\W)ensures that the match is preceded by a non-word character (in thise case, most likely a comma).app_major:matches the literal part of the string you’re looking for.(?'Number'\d+)is a captured group, which we labelNumber, where we’re trying to match one or more digits\d+.