Java Code Examples for com.google.gwt.regexp.shared.MatchResult#getGroup()
The following examples show how to use
com.google.gwt.regexp.shared.MatchResult#getGroup() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImportTreeDataSource.java From proarc with GNU General Public License v3.0 | 6 votes |
@Override protected void transformResponse(DSResponse response, DSRequest request, Object data) { if (RestConfig.isStatusOk(response)) { for (Record record : response.getData()) { String path = record.getAttribute(FIELD_PATH); RegExp pathRegExp = RegExp.compile("(.*/)?(.*)/$"); MatchResult mr = pathRegExp.exec(path); String parent = mr.getGroup(1); String name = mr.getGroup(2); // System.out.println("## ITRDS.path: " + path); // System.out.println("## ITRDS.parent: " + parent); // System.out.println("## ITRDS.name: " + name); record.setAttribute(FIELD_NAME, name); record.setAttribute(FIELD_PARENT, parent); } } super.transformResponse(response, request, data); }
Example 2
Source File: AuditLogItemDataProvider.java From core with GNU Lesser General Public License v2.1 | 5 votes |
private AuditLogItem parseItem(final MatchResult match) { String date = match.getGroup(1); AutoBean<AuditLogItem> itemBean = AutoBeanCodex.decode(beanFactory, AuditLogItem.class, match.getGroup(2)); AuditLogItem item = itemBean.as(); item.setId(idCounter++); item.setDate(date); return item; }
Example 3
Source File: AriaTabBar.java From unitime with Apache License 2.0 | 4 votes |
public String getTabLabel(int index) { String html = getTabHTML(index); if (html == null || html.isEmpty()) return ""; MatchResult result = sStripAcessKeyRegExp.exec(html); return (result == null ? html : result.getGroup(1) + result.getGroup(2) + result.getGroup(3)); }
Example 4
Source File: UniTimeHeaderPanel.java From unitime with Apache License 2.0 | 4 votes |
public static String stripAccessKey(String name) { if (name == null || name.isEmpty()) return ""; MatchResult result = sStripAcessKeyRegExp.exec(name); return (result == null ? name : result.getGroup(1) + result.getGroup(2) + result.getGroup(3)); }
Example 5
Source File: EditRuleWidget.java From geofence with GNU General Public License v2.0 | 4 votes |
public boolean checkIpRange(String s) { if(s == null || s.trim().equals("")) return true; RegExp regExp = RegExp.compile(CIDR_FORMAT); MatchResult matcher = regExp.exec(s); boolean matchFound = (matcher != null); // equivalent to regExp.test(inputStr); if (! matchFound) { Dispatcher.forwardEvent(GeofenceEvents.SEND_ALERT_MESSAGE, new String[] { "Input error", "Bad Range format" }); return false; } // Get address bytes for (int i=1; i<5; i++) { String groupStr = matcher.getGroup(i); int b = Integer.parseInt(groupStr); if(b>255) { Dispatcher.forwardEvent(GeofenceEvents.SEND_ALERT_MESSAGE, new String[] { "Input error", "Range bytes should be 0..255" }); return false; } } int size = Integer.parseInt(matcher.getGroup(5)); if(size > 32) { Dispatcher.forwardEvent(GeofenceEvents.SEND_ALERT_MESSAGE, new String[] { "Input error", "Bad CIDR block size" }); return false; } return true; }