C# Regex stops after first line matched
Posted
by
JD Guzman
on Stack Overflow
See other posts from Stack Overflow
or by JD Guzman
Published on 2012-04-08T11:15:42Z
Indexed on
2012/04/08
11:29 UTC
Read the original article
Hit count: 385
Ok so I have a regex and I need it to find matches in a multiline string. This is the string I am using:
Device Identifier: disk0
Device Node: /dev/disk0
Part of Whole: disk0
Device / Media Name: OCZ-VERTEX2 Media
Volume Name: Not applicable (no file system)
Mounted: Not applicable (no file system)
File System: None
Content (IOContent): GUID_partition_scheme
OS Can Be Installed: No
Media Type: Generic
Protocol: SATA
SMART Status: Verified
Total Size: 240.1 GB (240057409536 Bytes) (exactly 468862128 512-Byte-Blocks)
Volume Free Space: Not applicable (no file system)
Device Block Size: 512 Bytes
Read-Only Media: No
Read-Only Volume: Not applicable (no file system)
Ejectable: No
Whole: Yes
Internal: Yes
Solid State: Yes
OS 9 Drivers: No
Low Level Format: Not supported
Basically I need to separate each line into two groups with the colon as the separator. The regex I am using is:
@"([A-Za-z0-9\(\) \-\/]+):([A-Za-z0-9\(\) \-\/]+).*"
It does work but only picks up the first line and separates it into the two groups like I want but it stops at that point. I have tried the Multiline option but it doesn't make any difference.
I must admit I am new to the regex world.
Any help is appreciated.
© Stack Overflow or respective owner