Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2015 Eclipse RDF4J contributors, Aduna, and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Distribution License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *******************************************************************************/

public class Main {
    public static boolean isValidYearMonthDuration(String value) {

        // regex for checking valid xsd:yearMontheDuration string. See
        // http://www.schemacentral.com/sc/xsd/t-xsd_yearMonthDuration.html
        String regex = "-?P((\\d)+Y)?((\\d)+M)?";
        return value.length() > 1 && value.matches(regex);
    }
}