var flashvars = {
"client.allow.cross.domain" : "0",
"client.notify.cross.domain" : "1",
};
은 (C#의 경우)이 코드로 구문 분석되기를 원합니다..NET Regex 패턴?
private void parseVariables() {
String page;
Regex flashVars = new Regex("var flashvars = {(.*?)}", RegexOptions.Multiline | RegexOptions.IgnoreCase);
Regex var = new Regex(@"""(.*?)"",", RegexOptions.Multiline | RegexOptions.IgnoreCase);
Match flashVarsMatch;
MatchCollection matches;
String vars = "";
if (!IsLoggedIn)
{
throw new NotLoggedInException();
}
page = Request(URL_CLIENT);
flashVarsMatch = flashVars.Match(page);
matches = var.Matches(flashVarsMatch.Groups[1].Value);
if (matches.Count > 0)
{
foreach (Match item in matches)
{
vars += item.Groups[1].Value.Replace("\" : \"", "=") + "&";
}
}
}
@Scott : 그냥 학자 연합니다 : C#을 (자바 스크립트와는 달리) 전혀 정규식 지원이없는 프로그래밍 언어입니다. OTOH에서 .NET Framework에는 System.Text.RegularExpressions.Regex 클래스가 있습니다. –