9.jul. 3 dni od 205,00 EUR
Is it possible with single regex (match opr split) get 205,00 number from string? It must be single regex and not 2 or 3 regex which give 205,00 as result.
string looks like:
<option value="9.7.2010|3">9.jul. 3 dni od 205,00 EUR <option value="23.7.2010|3">23.jul. 3 dni od 205,00 EUR <option value="27.8.2010|3">27.avg. 3 dni od 205,00 EUR <option value="10.9.2010|3">10.sep. 3 dni od 205,00 EUR <option value="24.9.2010|3">24.sep. 3 dni od 205,00 EUR <option value="29.10.2010|3">29.okt. 3 dni od 205,00 EUR <option value="25.3.2011|3">25.mar. 3 dni od 205,00 EUR <option value="15.4.2011|3">15.apr. 3 dni od 205,00 EUR </select>
Perhaps
(\d+,\d\d) EUR$
You didn't really specify what the subject looks like in general.
There are two possible issues here
Is it a space (ASCII 32), or
? Or perhaps it's just any \\s
character?
I'm going to assume that it's just a regular space. If this is not the case, then substitute it in the following pattern.
To match only the numbers portion, you can use \\d+,\\d\\d(?= EUR)
. This uses lookahead (?=___)
so you only match the portion that you're interested in.
The other option is to match (\\d+,\\d\\d) EUR
and then extract Groups[1]
.
Your attempt of (\\d+,\\d\\d) EUR
(hopefully you weren't actually typing in
) should work, but you have to access group 1 out of the result to get just what's in the parentheses. For example:
Regex regex = new Regex(@"(\d+,\d\d) EUR");
Match match = regex.Match("9.jul. 3 dni od 205,00 EUR");
string cashString = match.Groups[1].Value;
The
will most likely be converted to ASCII 160 (html decoded), which is not the same as space. Using \\s+ will match no breaking spaces as well as normal space, tab and line feed/carriage return.
If it's not decoded then you should be able to use
instead of \\s+.
(\d+,\d+)\s+EUR
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.