ERLEDIGT
JA
JA
ANTWORTEN
2
2
ZUGRIFFE
812
812
EMPFEHLEN
-
27.06.06 23:47 #1
- Registriert seit
- Feb 2005
- Ort
- Kirchdorf a. d. Krems, OÖ
- Beiträge
- 213
hi, ich habe in C# zB folgenden string:
string s = @"<html>blubb\n\nblablabla\nXP: </span>57.981,20</div>\nbla\n</html>";
und ich will die zahl zwischen </span> und </div> wissen
die Regular Expression dazu ist:
new RegEx("XP: </span>.*</div>")
so findet er die zeile, aber weiss jemand wie ich das mache, dass ich nur die zahl bekomme mit regular expressions?
danke im vorraus
-
28.06.06 00:02 #2
- Registriert seit
- Aug 2001
- Ort
- Österreich, Stmk, Graz
- Beiträge
- 2.783
Hallo.
Code csharp:1 2 3 4 5 6 7 8 9 10
string s = @"<html>blubb\n\nblablabla\nXP: </span>57.981,20</div>\nbla\n</html>"; string pattern = @"XP:\ \</span\>(?<num>.*)\</div\>"; Match m = Regex.Match(s, pattern); if (m.Success && m.Groups.Count >= 1) { Console.WriteLine("XP: {0}", m.Groups["num"].Value); } else Console.WriteLine("nicht gefunden");
p.s.: Groß-/Kleinschreibung beachten?With the first link the chain is forged. The first speech censored, the first thought forbidden, the first freedom denied, chains us all irrevocably.
Aaron Satie
Legends... are the spice of the universe, Mr. Data, because they have a way of sometimes coming true.
Captain Jean-Luc Picard, Stardate ~41294.5
Tutorials.de chattet. Hier gibts auch .net Support ^^
Klickt auf chattet und nutzt den Webchat, oder verbindet euch zu irc.tutorials.de - Channel #Tutorials.de
(moo)blog furred.net // SiteInfo für WP7 // Pastebin für WP7 // BlogEngine.net Extensions
-
28.06.06 00:21 #3
- Registriert seit
- Feb 2005
- Ort
- Kirchdorf a. d. Krems, OÖ
- Beiträge
- 213
Ok Danke für deine schnelle Antwort!
Ich glaube ich habe das so halbwegs verstanden..
Vielen Dank, yan
Ähnliche Themen
-
Regular expressions
Von Grufy im Forum PHPAntworten: 2Letzter Beitrag: 16.02.08, 02:32 -
Regular Expressions
Von aeiber im Forum PHPAntworten: 0Letzter Beitrag: 07.04.07, 02:28 -
Regular Expressions
Von Drizztd im Forum Swing, Java2D/3D, SWT, JFaceAntworten: 3Letzter Beitrag: 03.01.07, 15:26 -
Regular Expressions
Von dennislassiter im Forum PHPAntworten: 1Letzter Beitrag: 21.05.06, 16:11 -
regular expressions
Von Scalé im Forum PHPAntworten: 0Letzter Beitrag: 06.03.02, 11:16





Zitieren

Login





