use of org.rstudio.core.client.regex.Match in project rstudio by rstudio.
the class RoxygenHelper method listParametersInRoxygenBlock.
private JsArrayString listParametersInRoxygenBlock(JsArrayString block, Pattern pattern) {
JsArrayString roxygenParams = JsArrayString.createArray().cast();
for (int i = 0; i < block.length(); i++) {
String line = block.get(i);
Match match = pattern.match(line, 0);
if (match != null)
roxygenParams.push(match.getGroup(1));
}
return roxygenParams;
}
use of org.rstudio.core.client.regex.Match in project rstudio by rstudio.
the class RTokenizer method peek.
private String peek(String regex) {
Match match = Pattern.create(regex).match(data_, pos_);
if (match == null)
return null;
int idx = match.getIndex();
if (idx != pos_)
return null;
return match.getValue();
}
use of org.rstudio.core.client.regex.Match in project rstudio by rstudio.
the class Link method removeHost.
/**
* If the URL has the same scheme, hostname, and port as the current page,
* then drop them from the URL.
*
* For example,
* http://rstudio.com/help/base/ls
* becomes
* /help/base/ls
*/
private String removeHost(String url) {
String pageUrl = Document.get().getURL();
Pattern p = Pattern.create("^http(s?)://[^/]+");
Match m = p.match(pageUrl, 0);
if (m == null) {
assert false : "Couldn't parse page URL: " + url;
return url;
}
String prefix = m.getValue();
if (!url.startsWith(prefix))
return url;
else
return url.substring(prefix.length());
}
use of org.rstudio.core.client.regex.Match in project rstudio by rstudio.
the class RequestLogEntry method getRequestMethodName.
public String getRequestMethodName() {
if (requestData_.equals("[REDACTED]"))
return requestData_;
Pattern p = Pattern.create("\\\"method\\\":\\s*\\\"([^\"]+)\\\"");
Match match = p.match(requestData_, 0);
if (match == null)
return null;
return match.getGroup(1);
}
use of org.rstudio.core.client.regex.Match in project rstudio by rstudio.
the class DomUtils method countLinesInternal.
private static int countLinesInternal(Text textNode, boolean pre) {
if (!pre)
return 0;
String value = textNode.getData();
Pattern pattern = Pattern.create("\\n");
int count = 0;
Match m = pattern.match(value, 0);
while (m != null) {
count++;
m = m.nextMatch();
}
return count;
}
Aggregations