-
August 18th, 2010, 07:57 PM
#1
[RESOLVED] Questions on parse operations
Not sure if they are called operations but here is the deal. I wrote some code.. it works perfectly - now some of the code I hijacks from coding forums. here is the code..
Code:
string[] files = Directory.GetFiles(GameRef.GetDocumentsDirectory + @"\My Documents\My Games\RPGBXL");
string dir = GameRef.GetDocumentsDirectory + @"\My Documents\My Games\RPGBXL";
foreach (string file in files)
{
FileInfo f = new FileInfo(file);
if (f.Extension == ".xml")
{
//parses out that huge Directory address!
string filename = Regex.Match(file, @"[^\\]*$").Value;
FilesToLoad.Add(filename);
}
}
this line here
Code:
string filename = Regex.Match(file, @"[^\\]*$").Value;
I don't know how it works... it works perfectly! And I know it parsing that huge directory string to make it smaller but what do these things mean?:
^ , \\ , *$ - I have no idea what those are doing
-
August 18th, 2010, 11:07 PM
#2
Re: Questions on parse operations
regular expressions are what they are. They are a highly tuned way of parsing and finding data. Here is a helpful link: http://www.regular-expressions.info/reference.html
Have fun with it!
-
August 19th, 2010, 02:22 AM
#3
Re: Questions on parse operations
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|