本文整理汇总了C++中JRegex::MatchWithin方法的典型用法代码示例。如果您正苦于以下问题:C++ JRegex::MatchWithin方法的具体用法?C++ JRegex::MatchWithin怎么用?C++ JRegex::MatchWithin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JRegex
的用法示例。
在下文中一共展示了JRegex::MatchWithin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
CBTCLStyler::StyleEmbeddedVariables
(
const Token& token
)
{
emptyVariablePattern.SetSingleLine();
variablePattern.SetSingleLine();
const JString& text = GetText();
JFontStyle varStyle = GetTypeStyle(token.type - kWhitespace);
varStyle.underlineCount++;
if (varStyle == GetTypeStyle(kVariable - kWhitespace))
{
varStyle.underlineCount++;
}
JFontStyle errStyle = GetTypeStyle(kError - kWhitespace);
errStyle.underlineCount++;
if (errStyle == GetTypeStyle(kVariable - kWhitespace))
{
errStyle.underlineCount++;
}
JIndexRange r = token.range, r1, r2;
while (!r.IsEmpty())
{
const JCharacter c = text.GetCharacter(r.first);
if (c == '\\')
{
r.first++;
}
else if (c == '$')
{
r1 = r - (r.first-1);
if (emptyVariablePattern.MatchWithin(text.GetCString() + r.first-1, r1, &r2))
{
r2 += r.first-1;
AdjustStyle(r2, errStyle);
r.first = r2.last;
}
else if (variablePattern.MatchWithin(text.GetCString() + r.first-1, r1, &r2))
{
r2 += r.first-1;
AdjustStyle(r2, varStyle);
r.first = r2.last;
}
}
r.first++;
}
}
示例2: if
JBoolean
CBHTMLScanner::IsScript
(
JString* language
)
const
{
scriptTagPattern1.SetCaseSensitive(kJFalse);
scriptTagPattern2.SetCaseSensitive(kJFalse);
scriptTagPattern3.SetCaseSensitive(kJFalse);
language->Clear();
const JString& text = GetScannedText();
const JCharacter* s = text.GetCString() + itsCurrentRange.first - 1;
JIndexRange r = itsCurrentRange - (itsCurrentRange.first - 1);
JArray<JIndexRange> matchList;
if (scriptTagPattern1.MatchWithin(s, r, &matchList))
{
*language = text.GetSubstring(matchList.GetElement(2) + (itsCurrentRange.first - 1));
return kJTrue;
}
else if (scriptTagPattern2.MatchWithin(s, r, &matchList))
{
*language = text.GetSubstring(matchList.GetElement(2) + (itsCurrentRange.first - 1));
return kJTrue;
}
else if (scriptTagPattern3.MatchWithin(s, r))
{
*language = "JavaScript";
return kJTrue;
}
else
{
return kJFalse;
}
}