Question Extract particular data from a css file

gladiator_jai

New member
Joined
Feb 12, 2009
Messages
3
Programming Experience
Beginner
Ok, here is the issue.

I have a xyz.css file which I read using the streamreader.

the file has text in the form

.Addfont { ......
.GridLayout {......
a.Master Layout {......

Now I need to extract the text between the '.' and '{'
In this case it would be
Addfont
GridLayout
Master Layout

How should I go about this.... I tried using the readline() method but it didn't work for the '{'

Please help me

Thank you
 
Thanks man worked great!!!
Can you please explain wat this part does

("[.](?<grab>[^{]*)[{]")


i knw the[.] and [{] are the delimiters...but wat does the part in red exactly mean...so that i can tune this a bit....
 
("[.](?<grab>[^{]*)[{]")

Explained:

The start ( and end ) brackets and " marks are not part of the regex. Ergo the regex is:

[.](?<grab>[^{]*)[{]

[.] = literal character of . (putting it in a character class it removes the special meaning of . being Any Character. Could also use \.)
(?<grab> = start a named capturing group
[^{]* = a sequence of 0 or more characters from the group: anything that is NOT a girly bracket {
) = end capturing group
[{] = literal character { (putting it in a character class removes special meaning of { being Start Of A Numbered Quantity Specifier. Could also use \{)

All text that is matched by [^{]* is captured into the group named "grab"
Hence the use of the code m.Groups("grab").Value to retrieve it
 
Back
Top