import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "<time from=\"(?P<TimeFrom>[\\dT:-]*)\" to=\"(?P<TimeTo>[\\dT:-]*)\" period=\"\\d\">.*?(?P<symbol>symbol number=\"\\d\").*?\\>.*?(?P<percipication>precipitation value=\"\\d\").*?\\>.*?(?P<windSpeed>windSpeed mps=\"[\\d\\.]*\").*?\\>.*?</time>";
final String string = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
+ "<weatherdata>\n"
+ " <location>\n"
+ " <name>Rykkinn</name>\n"
+ " <type>Settlement</type>\n"
+ " <country>Norway</country>\n"
+ " <timezone id=\"Europe/Oslo\" utcoffsetMinutes=\"120\" />\n"
+ " <location altitude=\"106\" latitude=\"59.9287412518508\" longitude=\"10.4753151421641\" geobase=\"ssr\" geobaseid=\"2234308\" />\n"
+ " </location>\n"
+ " <credit>\n"
+ " <!--In order to use the free weather data from yr no, you HAVE to display \n"
+ "the following text clearly visible on your web page. The text should be a \n"
+ "link to the specified URL.-->\n"
+ " <!--Please read more about our conditions and guidelines at http://om.yr.no/verdata/ English explanation at http://om.yr.no/verdata/free-weather-data/-->\n"
+ " <link text=\"Weather forecast from yr.no, delivered by the Norwegian Meteorological Institute and the NRK\" url=\"http://www.yr.no/place/Norway/Akershus/Bærum/Rykkinn/\" />\n"
+ " </credit>\n"
+ " <links>\n"
+ " <link id=\"xmlSource\" url=\"http://www.yr.no/place/Norway/Akershus/Bærum/Rykkinn/forecast.xml\" />\n"
+ " <link id=\"xmlSourceHourByHour\" url=\"http://www.yr.no/place/Norway/Akershus/Bærum/Rykkinn/forecast_hour_by_hour.xml\" />\n"
+ " <link id=\"overview\" url=\"http://www.yr.no/place/Norway/Akershus/Bærum/Rykkinn/\" />\n"
+ " <link id=\"hourByHour\" url=\"http://www.yr.no/place/Norway/Akershus/Bærum/Rykkinn/hour_by_hour\" />\n"
+ " <link id=\"longTermForecast\" url=\"http://www.yr.no/place/Norway/Akershus/Bærum/Rykkinn/long\" />\n"
+ " <link id=\"radar\" url=\"http://www.yr.no/place/Norway/Akershus/Bærum/Rykkinn/radar.html\" />\n"
+ " </links>\n"
+ " <meta>\n"
+ " <lastupdate>2015-09-29T10:33:00</lastupdate>\n"
+ " <nextupdate>2015-09-29T18:00:00</nextupdate>\n"
+ " </meta>\n"
+ " <sun rise=\"2015-09-29T07:17:49\" set=\"2015-09-29T18:57:55\" />\n"
+ " <forecast>\n"
+ " <text>\n"
+ " <location name=\"Rykkinn\">\n"
+ " <time from=\"2015-09-29\" to=\"2015-09-29\">\n"
+ " <title>Tuesday</title>\n"
+ " <body><strong>Østlandet og Telemark:</strong> Sørvestlig bris, i ettermiddag forbigående liten kuling på kysten. Etter hvert stort sett pent vær.</body>\n"
+ " </time>\n"
+ " <time from=\"2015-09-30\" to=\"2015-09-30\">\n"
+ " <title>Wednesday</title>\n"
+ " <body><strong>Østlandet:</strong> Vestlig eller skiftende bris. Stort sett pent vær, men om natten og først på dagen mulighet for lokal tåke.</body>\n"
+ " </time>\n"
+ " <time from=\"2015-10-01\" to=\"2015-10-01\">\n"
+ " <title>Thursday</title>\n"
+ " <body><strong>Østafjells:</strong> Vestlig bris, liten kuling på kysten vest for Lindesnes. Oppholdsvær og perioder med sol.</body>\n"
+ " </time>\n"
+ " <time from=\"2015-10-02\" to=\"2015-10-02\">\n"
+ " <title>Friday</title>\n"
+ " <body><strong>Østafjells:</strong> Vestlig bris, periodevis kuling på kysten vest for Lindesnes. Stort sett pent vær. Omtrent uendret temperatur.</body>\n"
+ " </time>\n"
+ " <time from=\"2015-10-03\" to=\"2015-10-04\">\n"
+ " <title>Saturday and Sunday</title>\n"
+ " <body><strong>Østafjells og fjellet i Sør-Norge:</strong> Skiftende bris. Lørdag oppholdsvær og perioder med sol. Omtrent uendret temperatur. Søndag spredt regn. Litt lavere temperatur.</body>\n"
+ " </time>\n"
+ " <time from=\"2015-10-05\" to=\"2015-10-08\">\n"
+ " <title>Monday to Thursday</title>\n"
+ " <body><strong>Sør-Norge:</strong> Høytrykket flytter seg østover og gir rom for mer ustabilt vær. Overveiende sørlig vind, perioder med kuling på kysten. Etterhvert perioder med nedbør. Litt lavere dagtemperaturer.</body>\n"
+ " </time>\n"
+ " </location>\n"
+ " </text>\n"
+ " <tabular>\n"
+ " <time from=\"2015-09-29T17:00:00\" to=\"2015-09-29T18:00:00\" period=\"2\">\n"
+ " <!-- Valid from 2015-09-29T17:00:00 to 2015-09-29T18:00:00 -->\n"
+ " <symbol number=\"3\" numberEx=\"3\" name=\"Partly cloudy\" var=\"03d\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-09-29T17:00:00 -->\n"
+ " <windDirection deg=\"140.3\" code=\"SE\" name=\"Southeast\" />\n"
+ " <windSpeed mps=\"1.5\" name=\"Light air\" />\n"
+ " <temperature unit=\"celsius\" value=\"15\" />\n"
+ " <pressure unit=\"hPa\" value=\"1035.7\" />\n"
+ " </time>\n"
+ " <time from=\"2015-09-29T18:00:00\" to=\"2015-09-30T00:00:00\" period=\"3\">\n"
+ " <!-- Valid from 2015-09-29T18:00:00 to 2015-09-30T00:00:00 -->\n"
+ " <symbol number=\"3\" numberEx=\"3\" name=\"Partly cloudy\" var=\"mf/03n.53\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-09-29T18:00:00 -->\n"
+ " <windDirection deg=\"132.5\" code=\"SE\" name=\"Southeast\" />\n"
+ " <windSpeed mps=\"1.4\" name=\"Light air\" />\n"
+ " <temperature unit=\"celsius\" value=\"14\" />\n"
+ " <pressure unit=\"hPa\" value=\"1035.3\" />\n"
+ " </time>\n"
+ " <time from=\"2015-09-30T00:00:00\" to=\"2015-09-30T06:00:00\" period=\"0\">\n"
+ " <!-- Valid from 2015-09-30T00:00:00 to 2015-09-30T06:00:00 -->\n"
+ " <symbol number=\"3\" numberEx=\"3\" name=\"Partly cloudy\" var=\"mf/03n.56\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-09-30T00:00:00 -->\n"
+ " <windDirection deg=\"358.4\" code=\"N\" name=\"North\" />\n"
+ " <windSpeed mps=\"2.0\" name=\"Light breeze\" />\n"
+ " <temperature unit=\"celsius\" value=\"6\" />\n"
+ " <pressure unit=\"hPa\" value=\"1035.1\" />\n"
+ " </time>\n"
+ " <time from=\"2015-09-30T06:00:00\" to=\"2015-09-30T12:00:00\" period=\"1\">\n"
+ " <!-- Valid from 2015-09-30T06:00:00 to 2015-09-30T12:00:00 -->\n"
+ " <symbol number=\"2\" numberEx=\"2\" name=\"Fair\" var=\"02d\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-09-30T06:00:00 -->\n"
+ " <windDirection deg=\"68.7\" code=\"ENE\" name=\"East-northeast\" />\n"
+ " <windSpeed mps=\"0.6\" name=\"Light air\" />\n"
+ " <temperature unit=\"celsius\" value=\"4\" />\n"
+ " <pressure unit=\"hPa\" value=\"1033.8\" />\n"
+ " </time>\n"
+ " <time from=\"2015-09-30T12:00:00\" to=\"2015-09-30T18:00:00\" period=\"2\">\n"
+ " <!-- Valid from 2015-09-30T12:00:00 to 2015-09-30T18:00:00 -->\n"
+ " <symbol number=\"2\" numberEx=\"2\" name=\"Fair\" var=\"02d\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-09-30T12:00:00 -->\n"
+ " <windDirection deg=\"143.9\" code=\"SE\" name=\"Southeast\" />\n"
+ " <windSpeed mps=\"1.1\" name=\"Light air\" />\n"
+ " <temperature unit=\"celsius\" value=\"13\" />\n"
+ " <pressure unit=\"hPa\" value=\"1034.1\" />\n"
+ " </time>\n"
+ " <time from=\"2015-09-30T18:00:00\" to=\"2015-10-01T00:00:00\" period=\"3\">\n"
+ " <!-- Valid from 2015-09-30T18:00:00 to 2015-10-01T00:00:00 -->\n"
+ " <symbol number=\"3\" numberEx=\"3\" name=\"Partly cloudy\" var=\"mf/03n.56\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-09-30T18:00:00 -->\n"
+ " <windDirection deg=\"129.3\" code=\"SE\" name=\"Southeast\" />\n"
+ " <windSpeed mps=\"0.6\" name=\"Light air\" />\n"
+ " <temperature unit=\"celsius\" value=\"15\" />\n"
+ " <pressure unit=\"hPa\" value=\"1030.6\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-01T00:00:00\" to=\"2015-10-01T06:00:00\" period=\"0\">\n"
+ " <!-- Valid from 2015-10-01T00:00:00 to 2015-10-01T06:00:00 -->\n"
+ " <symbol number=\"3\" numberEx=\"3\" name=\"Partly cloudy\" var=\"mf/03n.60\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-01T00:00:00 -->\n"
+ " <windDirection deg=\"338.6\" code=\"NNW\" name=\"North-northwest\" />\n"
+ " <windSpeed mps=\"1.6\" name=\"Light breeze\" />\n"
+ " <temperature unit=\"celsius\" value=\"7\" />\n"
+ " <pressure unit=\"hPa\" value=\"1028.4\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-01T06:00:00\" to=\"2015-10-01T12:00:00\" period=\"1\">\n"
+ " <!-- Valid from 2015-10-01T06:00:00 to 2015-10-01T12:00:00 -->\n"
+ " <symbol number=\"3\" numberEx=\"3\" name=\"Partly cloudy\" var=\"03d\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-01T06:00:00 -->\n"
+ " <windDirection deg=\"324.0\" code=\"NW\" name=\"Northwest\" />\n"
+ " <windSpeed mps=\"2.5\" name=\"Light breeze\" />\n"
+ " <temperature unit=\"celsius\" value=\"6\" />\n"
+ " <pressure unit=\"hPa\" value=\"1025.8\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-01T12:00:00\" to=\"2015-10-01T18:00:00\" period=\"2\">\n"
+ " <!-- Valid from 2015-10-01T12:00:00 to 2015-10-01T18:00:00 -->\n"
+ " <symbol number=\"3\" numberEx=\"3\" name=\"Partly cloudy\" var=\"03d\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-01T12:00:00 -->\n"
+ " <windDirection deg=\"142.8\" code=\"SE\" name=\"Southeast\" />\n"
+ " <windSpeed mps=\"1.3\" name=\"Light air\" />\n"
+ " <temperature unit=\"celsius\" value=\"13\" />\n"
+ " <pressure unit=\"hPa\" value=\"1025.9\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-01T18:00:00\" to=\"2015-10-02T00:00:00\" period=\"3\">\n"
+ " <!-- Valid from 2015-10-01T18:00:00 to 2015-10-02T00:00:00 -->\n"
+ " <symbol number=\"2\" numberEx=\"2\" name=\"Fair\" var=\"mf/02n.60\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-01T18:00:00 -->\n"
+ " <windDirection deg=\"270.6\" code=\"W\" name=\"West\" />\n"
+ " <windSpeed mps=\"1.0\" name=\"Light air\" />\n"
+ " <temperature unit=\"celsius\" value=\"16\" />\n"
+ " <pressure unit=\"hPa\" value=\"1023.2\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-02T02:00:00\" to=\"2015-10-02T08:00:00\" period=\"0\">\n"
+ " <!-- Valid from 2015-10-02T02:00:00 to 2015-10-02T08:00:00 -->\n"
+ " <symbol number=\"4\" numberEx=\"4\" name=\"Cloudy\" var=\"04\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-02T02:00:00 -->\n"
+ " <windDirection deg=\"143.5\" code=\"SE\" name=\"Southeast\" />\n"
+ " <windSpeed mps=\"0.4\" name=\"Light air\" />\n"
+ " <temperature unit=\"celsius\" value=\"7\" />\n"
+ " <pressure unit=\"hPa\" value=\"1020.1\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-02T08:00:00\" to=\"2015-10-02T14:00:00\" period=\"1\">\n"
+ " <!-- Valid from 2015-10-02T08:00:00 to 2015-10-02T14:00:00 -->\n"
+ " <symbol number=\"3\" numberEx=\"3\" name=\"Partly cloudy\" var=\"03d\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-02T08:00:00 -->\n"
+ " <windDirection deg=\"288.8\" code=\"WNW\" name=\"West-northwest\" />\n"
+ " <windSpeed mps=\"1.7\" name=\"Light breeze\" />\n"
+ " <temperature unit=\"celsius\" value=\"9\" />\n"
+ " <pressure unit=\"hPa\" value=\"1018.2\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-02T14:00:00\" to=\"2015-10-02T20:00:00\" period=\"2\">\n"
+ " <!-- Valid from 2015-10-02T14:00:00 to 2015-10-02T20:00:00 -->\n"
+ " <symbol number=\"1\" numberEx=\"1\" name=\"Clear sky\" var=\"01d\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-02T14:00:00 -->\n"
+ " <windDirection deg=\"234.6\" code=\"SW\" name=\"Southwest\" />\n"
+ " <windSpeed mps=\"1.6\" name=\"Light breeze\" />\n"
+ " <temperature unit=\"celsius\" value=\"16\" />\n"
+ " <pressure unit=\"hPa\" value=\"1018.2\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-02T20:00:00\" to=\"2015-10-03T02:00:00\" period=\"3\">\n"
+ " <!-- Valid from 2015-10-02T20:00:00 to 2015-10-03T02:00:00 -->\n"
+ " <symbol number=\"1\" numberEx=\"1\" name=\"Clear sky\" var=\"mf/01n.63\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-02T20:00:00 -->\n"
+ " <windDirection deg=\"231.8\" code=\"SW\" name=\"Southwest\" />\n"
+ " <windSpeed mps=\"1.7\" name=\"Light breeze\" />\n"
+ " <temperature unit=\"celsius\" value=\"13\" />\n"
+ " <pressure unit=\"hPa\" value=\"1017.4\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-03T02:00:00\" to=\"2015-10-03T08:00:00\" period=\"0\">\n"
+ " <!-- Valid from 2015-10-03T02:00:00 to 2015-10-03T08:00:00 -->\n"
+ " <symbol number=\"3\" numberEx=\"3\" name=\"Partly cloudy\" var=\"mf/03n.66\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-03T02:00:00 -->\n"
+ " <windDirection deg=\"336.2\" code=\"NNW\" name=\"North-northwest\" />\n"
+ " <windSpeed mps=\"1.6\" name=\"Light breeze\" />\n"
+ " <temperature unit=\"celsius\" value=\"10\" />\n"
+ " <pressure unit=\"hPa\" value=\"1018.5\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-03T08:00:00\" to=\"2015-10-03T14:00:00\" period=\"1\">\n"
+ " <!-- Valid from 2015-10-03T08:00:00 to 2015-10-03T14:00:00 -->\n"
+ " <symbol number=\"3\" numberEx=\"3\" name=\"Partly cloudy\" var=\"03d\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-03T08:00:00 -->\n"
+ " <windDirection deg=\"332.3\" code=\"NNW\" name=\"North-northwest\" />\n"
+ " <windSpeed mps=\"1.5\" name=\"Light air\" />\n"
+ " <temperature unit=\"celsius\" value=\"8\" />\n"
+ " <pressure unit=\"hPa\" value=\"1019.1\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-03T14:00:00\" to=\"2015-10-03T20:00:00\" period=\"2\">\n"
+ " <!-- Valid from 2015-10-03T14:00:00 to 2015-10-03T20:00:00 -->\n"
+ " <symbol number=\"3\" numberEx=\"3\" name=\"Partly cloudy\" var=\"03d\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-03T14:00:00 -->\n"
+ " <windDirection deg=\"26.6\" code=\"NNE\" name=\"North-northeast\" />\n"
+ " <windSpeed mps=\"1.2\" name=\"Light air\" />\n"
+ " <temperature unit=\"celsius\" value=\"13\" />\n"
+ " <pressure unit=\"hPa\" value=\"1019.9\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-03T20:00:00\" to=\"2015-10-04T02:00:00\" period=\"3\">\n"
+ " <!-- Valid from 2015-10-03T20:00:00 to 2015-10-04T02:00:00 -->\n"
+ " <symbol number=\"4\" numberEx=\"4\" name=\"Cloudy\" var=\"04\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-03T20:00:00 -->\n"
+ " <windDirection deg=\"153.9\" code=\"SSE\" name=\"South-southeast\" />\n"
+ " <windSpeed mps=\"1.5\" name=\"Light air\" />\n"
+ " <temperature unit=\"celsius\" value=\"11\" />\n"
+ " <pressure unit=\"hPa\" value=\"1019.4\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-04T02:00:00\" to=\"2015-10-04T08:00:00\" period=\"0\">\n"
+ " <!-- Valid from 2015-10-04T02:00:00 to 2015-10-04T08:00:00 -->\n"
+ " <symbol number=\"4\" numberEx=\"4\" name=\"Cloudy\" var=\"04\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-04T02:00:00 -->\n"
+ " <windDirection deg=\"115.6\" code=\"ESE\" name=\"East-southeast\" />\n"
+ " <windSpeed mps=\"1.5\" name=\"Light air\" />\n"
+ " <temperature unit=\"celsius\" value=\"10\" />\n"
+ " <pressure unit=\"hPa\" value=\"1019.1\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-04T08:00:00\" to=\"2015-10-04T14:00:00\" period=\"1\">\n"
+ " <!-- Valid from 2015-10-04T08:00:00 to 2015-10-04T14:00:00 -->\n"
+ " <symbol number=\"4\" numberEx=\"4\" name=\"Cloudy\" var=\"04\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-04T08:00:00 -->\n"
+ " <windDirection deg=\"163.6\" code=\"SSE\" name=\"South-southeast\" />\n"
+ " <windSpeed mps=\"1.2\" name=\"Light air\" />\n"
+ " <temperature unit=\"celsius\" value=\"10\" />\n"
+ " <pressure unit=\"hPa\" value=\"1017.7\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-04T14:00:00\" to=\"2015-10-04T20:00:00\" period=\"2\">\n"
+ " <!-- Valid from 2015-10-04T14:00:00 to 2015-10-04T20:00:00 -->\n"
+ " <symbol number=\"4\" numberEx=\"4\" name=\"Cloudy\" var=\"04\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-04T14:00:00 -->\n"
+ " <windDirection deg=\"163.7\" code=\"SSE\" name=\"South-southeast\" />\n"
+ " <windSpeed mps=\"1.1\" name=\"Light air\" />\n"
+ " <temperature unit=\"celsius\" value=\"11\" />\n"
+ " <pressure unit=\"hPa\" value=\"1017.7\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-04T20:00:00\" to=\"2015-10-05T02:00:00\" period=\"3\">\n"
+ " <!-- Valid from 2015-10-04T20:00:00 to 2015-10-05T02:00:00 -->\n"
+ " <symbol number=\"4\" numberEx=\"4\" name=\"Cloudy\" var=\"04\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-04T20:00:00 -->\n"
+ " <windDirection deg=\"351.4\" code=\"N\" name=\"North\" />\n"
+ " <windSpeed mps=\"1.2\" name=\"Light air\" />\n"
+ " <temperature unit=\"celsius\" value=\"11\" />\n"
+ " <pressure unit=\"hPa\" value=\"1016.5\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-05T02:00:00\" to=\"2015-10-05T08:00:00\" period=\"0\">\n"
+ " <!-- Valid from 2015-10-05T02:00:00 to 2015-10-05T08:00:00 -->\n"
+ " <symbol number=\"4\" numberEx=\"4\" name=\"Cloudy\" var=\"04\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-05T02:00:00 -->\n"
+ " <windDirection deg=\"174.1\" code=\"S\" name=\"South\" />\n"
+ " <windSpeed mps=\"1.2\" name=\"Light air\" />\n"
+ " <temperature unit=\"celsius\" value=\"10\" />\n"
+ " <pressure unit=\"hPa\" value=\"1016.0\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-05T08:00:00\" to=\"2015-10-05T14:00:00\" period=\"1\">\n"
+ " <!-- Valid from 2015-10-05T08:00:00 to 2015-10-05T14:00:00 -->\n"
+ " <symbol number=\"4\" numberEx=\"4\" name=\"Cloudy\" var=\"04\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-05T08:00:00 -->\n"
+ " <windDirection deg=\"225.4\" code=\"SW\" name=\"Southwest\" />\n"
+ " <windSpeed mps=\"1.2\" name=\"Light air\" />\n"
+ " <temperature unit=\"celsius\" value=\"10\" />\n"
+ " <pressure unit=\"hPa\" value=\"1015.1\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-05T14:00:00\" to=\"2015-10-05T20:00:00\" period=\"2\">\n"
+ " <!-- Valid from 2015-10-05T14:00:00 to 2015-10-05T20:00:00 -->\n"
+ " <symbol number=\"4\" numberEx=\"4\" name=\"Cloudy\" var=\"04\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-05T14:00:00 -->\n"
+ " <windDirection deg=\"66.5\" code=\"ENE\" name=\"East-northeast\" />\n"
+ " <windSpeed mps=\"1.8\" name=\"Light breeze\" />\n"
+ " <temperature unit=\"celsius\" value=\"11\" />\n"
+ " <pressure unit=\"hPa\" value=\"1015.2\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-05T20:00:00\" to=\"2015-10-06T02:00:00\" period=\"3\">\n"
+ " <!-- Valid from 2015-10-05T20:00:00 to 2015-10-06T02:00:00 -->\n"
+ " <symbol number=\"4\" numberEx=\"4\" name=\"Cloudy\" var=\"04\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-05T20:00:00 -->\n"
+ " <windDirection deg=\"124.9\" code=\"SE\" name=\"Southeast\" />\n"
+ " <windSpeed mps=\"1.4\" name=\"Light air\" />\n"
+ " <temperature unit=\"celsius\" value=\"10\" />\n"
+ " <pressure unit=\"hPa\" value=\"1014.4\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-06T02:00:00\" to=\"2015-10-06T08:00:00\" period=\"0\">\n"
+ " <!-- Valid from 2015-10-06T02:00:00 to 2015-10-06T08:00:00 -->\n"
+ " <symbol number=\"9\" numberEx=\"9\" name=\"Rain\" var=\"09\" />\n"
+ " <precipitation value=\"2.4\" />\n"
+ " <!-- Valid at 2015-10-06T02:00:00 -->\n"
+ " <windDirection deg=\"61.0\" code=\"ENE\" name=\"East-northeast\" />\n"
+ " <windSpeed mps=\"2.3\" name=\"Light breeze\" />\n"
+ " <temperature unit=\"celsius\" value=\"11\" />\n"
+ " <pressure unit=\"hPa\" value=\"1010.5\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-06T08:00:00\" to=\"2015-10-06T14:00:00\" period=\"1\">\n"
+ " <!-- Valid from 2015-10-06T08:00:00 to 2015-10-06T14:00:00 -->\n"
+ " <symbol number=\"9\" numberEx=\"9\" name=\"Rain\" var=\"09\" />\n"
+ " <precipitation value=\"2.8\" />\n"
+ " <!-- Valid at 2015-10-06T08:00:00 -->\n"
+ " <windDirection deg=\"77.9\" code=\"ENE\" name=\"East-northeast\" />\n"
+ " <windSpeed mps=\"2.4\" name=\"Light breeze\" />\n"
+ " <temperature unit=\"celsius\" value=\"11\" />\n"
+ " <pressure unit=\"hPa\" value=\"1004.4\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-06T14:00:00\" to=\"2015-10-06T20:00:00\" period=\"2\">\n"
+ " <!-- Valid from 2015-10-06T14:00:00 to 2015-10-06T20:00:00 -->\n"
+ " <symbol number=\"4\" numberEx=\"4\" name=\"Cloudy\" var=\"04\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-06T14:00:00 -->\n"
+ " <windDirection deg=\"103.5\" code=\"ESE\" name=\"East-southeast\" />\n"
+ " <windSpeed mps=\"2.6\" name=\"Light breeze\" />\n"
+ " <temperature unit=\"celsius\" value=\"12\" />\n"
+ " <pressure unit=\"hPa\" value=\"1014.0\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-06T20:00:00\" to=\"2015-10-07T02:00:00\" period=\"3\">\n"
+ " <!-- Valid from 2015-10-06T20:00:00 to 2015-10-07T02:00:00 -->\n"
+ " <symbol number=\"9\" numberEx=\"9\" name=\"Rain\" var=\"09\" />\n"
+ " <precipitation value=\"2.4\" />\n"
+ " <!-- Valid at 2015-10-06T20:00:00 -->\n"
+ " <windDirection deg=\"169.5\" code=\"S\" name=\"South\" />\n"
+ " <windSpeed mps=\"3.5\" name=\"Gentle breeze\" />\n"
+ " <temperature unit=\"celsius\" value=\"12\" />\n"
+ " <pressure unit=\"hPa\" value=\"1009.2\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-07T02:00:00\" to=\"2015-10-07T08:00:00\" period=\"0\">\n"
+ " <!-- Valid from 2015-10-07T02:00:00 to 2015-10-07T08:00:00 -->\n"
+ " <symbol number=\"4\" numberEx=\"4\" name=\"Cloudy\" var=\"04\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-07T02:00:00 -->\n"
+ " <windDirection deg=\"87.2\" code=\"E\" name=\"East\" />\n"
+ " <windSpeed mps=\"1.8\" name=\"Light breeze\" />\n"
+ " <temperature unit=\"celsius\" value=\"11\" />\n"
+ " <pressure unit=\"hPa\" value=\"1015.2\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-07T08:00:00\" to=\"2015-10-07T14:00:00\" period=\"1\">\n"
+ " <!-- Valid from 2015-10-07T08:00:00 to 2015-10-07T14:00:00 -->\n"
+ " <symbol number=\"4\" numberEx=\"4\" name=\"Cloudy\" var=\"04\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-07T08:00:00 -->\n"
+ " <windDirection deg=\"85.0\" code=\"E\" name=\"East\" />\n"
+ " <windSpeed mps=\"1.7\" name=\"Light breeze\" />\n"
+ " <temperature unit=\"celsius\" value=\"10\" />\n"
+ " <pressure unit=\"hPa\" value=\"1014.6\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-07T14:00:00\" to=\"2015-10-07T20:00:00\" period=\"2\">\n"
+ " <!-- Valid from 2015-10-07T14:00:00 to 2015-10-07T20:00:00 -->\n"
+ " <symbol number=\"4\" numberEx=\"4\" name=\"Cloudy\" var=\"04\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-07T14:00:00 -->\n"
+ " <windDirection deg=\"302.4\" code=\"WNW\" name=\"West-northwest\" />\n"
+ " <windSpeed mps=\"2.3\" name=\"Light breeze\" />\n"
+ " <temperature unit=\"celsius\" value=\"12\" />\n"
+ " <pressure unit=\"hPa\" value=\"1016.6\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-07T20:00:00\" to=\"2015-10-08T02:00:00\" period=\"3\">\n"
+ " <!-- Valid from 2015-10-07T20:00:00 to 2015-10-08T02:00:00 -->\n"
+ " <symbol number=\"9\" numberEx=\"9\" name=\"Rain\" var=\"09\" />\n"
+ " <precipitation value=\"2.1\" />\n"
+ " <!-- Valid at 2015-10-07T20:00:00 -->\n"
+ " <windDirection deg=\"111.2\" code=\"ESE\" name=\"East-southeast\" />\n"
+ " <windSpeed mps=\"3.0\" name=\"Light breeze\" />\n"
+ " <temperature unit=\"celsius\" value=\"12\" />\n"
+ " <pressure unit=\"hPa\" value=\"1009.5\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-08T02:00:00\" to=\"2015-10-08T08:00:00\" period=\"0\">\n"
+ " <!-- Valid from 2015-10-08T02:00:00 to 2015-10-08T08:00:00 -->\n"
+ " <symbol number=\"4\" numberEx=\"4\" name=\"Cloudy\" var=\"04\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-08T02:00:00 -->\n"
+ " <windDirection deg=\"283.1\" code=\"WNW\" name=\"West-northwest\" />\n"
+ " <windSpeed mps=\"1.7\" name=\"Light breeze\" />\n"
+ " <temperature unit=\"celsius\" value=\"11\" />\n"
+ " <pressure unit=\"hPa\" value=\"1012.4\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-08T08:00:00\" to=\"2015-10-08T14:00:00\" period=\"1\">\n"
+ " <!-- Valid from 2015-10-08T08:00:00 to 2015-10-08T14:00:00 -->\n"
+ " <symbol number=\"4\" numberEx=\"4\" name=\"Cloudy\" var=\"04\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-08T08:00:00 -->\n"
+ " <windDirection deg=\"4.6\" code=\"N\" name=\"North\" />\n"
+ " <windSpeed mps=\"1.8\" name=\"Light breeze\" />\n"
+ " <temperature unit=\"celsius\" value=\"11\" />\n"
+ " <pressure unit=\"hPa\" value=\"1014.3\" />\n"
+ " </time>\n"
+ " <time from=\"2015-10-08T14:00:00\" to=\"2015-10-08T20:00:00\" period=\"2\">\n"
+ " <!-- Valid from 2015-10-08T14:00:00 to 2015-10-08T20:00:00 -->\n"
+ " <symbol number=\"4\" numberEx=\"4\" name=\"Cloudy\" var=\"04\" />\n"
+ " <precipitation value=\"0\" />\n"
+ " <!-- Valid at 2015-10-08T14:00:00 -->\n"
+ " <windDirection deg=\"150.2\" code=\"SSE\" name=\"South-southeast\" />\n"
+ " <windSpeed mps=\"2.3\" name=\"Light breeze\" />\n"
+ " <temperature unit=\"celsius\" value=\"12\" />\n"
+ " <pressure unit=\"hPa\" value=\"1017.7\" />\n"
+ " </time>\n"
+ " </tabular>\n"
+ " </forecast>\n"
+ " <observations>\n"
+ " <weatherstation stno=\"19710\" sttype=\"eklima\" name=\"Asker (Sem)\" distance=\"8384\" lat=\"59.85620\" lon=\"10.43450\" source=\"Meteorologisk Institutt\">\n"
+ " <temperature unit=\"celsius\" value=\"16.2\" time=\"2015-09-29T14:00:00Z\" />\n"
+ " </weatherstation>\n"
+ " <weatherstation stno=\"18815\" sttype=\"eklima\" name=\"Bygdøy\" distance=\"11865\" lat=\"59.90500\" lon=\"10.68280\" source=\"Meteorologisk Institutt\">\n"
+ " <temperature unit=\"celsius\" value=\"16.7\" time=\"2015-09-29T14:00:00Z\" />\n"
+ " </weatherstation>\n"
+ " <weatherstation stno=\"18950\" sttype=\"eklima\" name=\"Tryvannshøgda\" distance=\"12467\" lat=\"59.98470\" lon=\"10.66930\" source=\"Meteorologisk Institutt\">\n"
+ " <temperature unit=\"celsius\" value=\"12.5\" time=\"2015-09-29T14:00:00Z\" />\n"
+ " <windDirection deg=\"186.0\" code=\"S\" name=\"South\" time=\"2015-09-29T14:00:00Z\" />\n"
+ " <windSpeed mps=\"4.0\" name=\"Gentle breeze\" time=\"2015-09-29T14:00:00Z\" />\n"
+ " </weatherstation>\n"
+ " </observations>\n"
+ "</weatherdata>";
final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE | Pattern.DOTALL | Pattern.UNICODE_CASE | Pattern.CASE_INSENSITIVE);
final Matcher matcher = pattern.matcher(string);
while (matcher.find()) {
System.out.println("Full match: " + matcher.group(0));
for (int i = 1; i <= matcher.groupCount(); i++) {
System.out.println("Group " + i + ": " + matcher.group(i));
}
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html