Regular expression help wanted!

i am not familar with regex but maybe this can help


int position = 0;
string path = "xxx\xxx\xxx\xxx";
position = path.LastIndexOf(\\);
string temp = path.Substring(0, position -1);
position = temp.LastIndexOf(\\);

string wanted = path.Substring(position+1);


this is a workaround
 
[VB]

Dim s As String = "1xx\x2x\abc\987"
Const e As String = "([^\\]+)\\([^\\]+)$"

With Regex.Match(s, e)
Console.WriteLine(.Groups(1).Value()) abc
Console.WriteLine(.Groups(2).Value()) 987
End With

[/VB]
 
Last edited by a moderator:
interesting...i am a parser :)

if you use @ before string then you can write \ instead of \\
:)
 
Back
Top