<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Hilfe bei regulärem Ausdruck]]></title><description><![CDATA[<p>So blöd das klingt, ich kriegs nicht hin mir reguläre Ausdrücke (mit boost, aber das gibt's ja auch in der C++ Standard Lib oder?) beizubringen..<br />
Wenn mir jemand folgendes Beispiel lösen könnte, wär ich aber wohl schon nen ganzen Schritt weiter.</p>
<p>Ich hab mehrere <code>std::string</code> 's, wo irgendwo sowas drin vorkommt: &quot;sxxexx&quot;<br />
Das 's' und das 'e' können auch mal groß sein. x steht für eine Ziffer. Ich will einfach nur die beiden Zahlen nach diesen beiden Buchstaben haben und in zwei ints speichern. Kann doch nicht so schwer sein.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/308759/hilfe-bei-regulärem-ausdruck</link><generator>RSS for Node</generator><lastBuildDate>Wed, 05 Aug 2026 15:18:43 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/308759.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 04 Oct 2012 17:48:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Hilfe bei regulärem Ausdruck on Thu, 04 Oct 2012 17:48:23 GMT]]></title><description><![CDATA[<p>So blöd das klingt, ich kriegs nicht hin mir reguläre Ausdrücke (mit boost, aber das gibt's ja auch in der C++ Standard Lib oder?) beizubringen..<br />
Wenn mir jemand folgendes Beispiel lösen könnte, wär ich aber wohl schon nen ganzen Schritt weiter.</p>
<p>Ich hab mehrere <code>std::string</code> 's, wo irgendwo sowas drin vorkommt: &quot;sxxexx&quot;<br />
Das 's' und das 'e' können auch mal groß sein. x steht für eine Ziffer. Ich will einfach nur die beiden Zahlen nach diesen beiden Buchstaben haben und in zwei ints speichern. Kann doch nicht so schwer sein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2257127</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2257127</guid><dc:creator><![CDATA[Incocnito]]></dc:creator><pubDate>Thu, 04 Oct 2012 17:48:23 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe bei regulärem Ausdruck on Thu, 04 Oct 2012 17:59:40 GMT]]></title><description><![CDATA[<p>Hast du Probleme mit regulären Ausdrücken an sich oder mit der Benutzung in C++? Für ersteres gibt es viele Online-Seiten, auf denen du live deine regulären Ausdrücke testen kannst. Ich benutze z.B. <a href="http://rubular.com" rel="nofollow">http://rubular.com</a>, weil ich reguläre Ausdrücke haupsächlich in Ruby benutze. Ein hier passender regulärer Ausdruck wäre <code>s(\d{2})e(\d{2})</code> mit dem Parameter &quot;case insensitive&quot;. Dann stehen die Zahlen in den beiden gematchten Gruppen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2257134</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2257134</guid><dc:creator><![CDATA[Michael E.]]></dc:creator><pubDate>Thu, 04 Oct 2012 17:59:40 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe bei regulärem Ausdruck on Thu, 04 Oct 2012 18:04:08 GMT]]></title><description><![CDATA[<p>Ich hab jetzt ganz konkret Probleme mit der Benutzung von Boost.Regex in C++.<br />
Ich hab keine Ahnung, wie ich jetzt mithilfe dieses regulären Ausdrucks <code>(\d{2})e(\d{2})</code> an meine 2 Variablen aus dem string in C++ mit boost komme. Ein kleines Codeschnipsel wäre nett. Den Rest kann ich mir ableiten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2257137</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2257137</guid><dc:creator><![CDATA[Incocnito]]></dc:creator><pubDate>Thu, 04 Oct 2012 18:04:08 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe bei regulärem Ausdruck on Thu, 04 Oct 2012 18:39:15 GMT]]></title><description><![CDATA[<p>Ich habe heute das erste Mal Boost mit Visual Studio kompiliert und als Test das hier geschrieben, vielleicht hilft es dir:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;boost/regex.hpp&gt;

int main()
{
	boost::regex regex(&quot;(one|two|three)&quot;);
	boost::cmatch matches;
	boost::regex_search(&quot;three in a row&quot;, matches, regex);
    std::cout &lt;&lt; &quot;The search-string is: three in a row&quot; &lt;&lt; std::endl;
	std::cout &lt;&lt; &quot;First match of the RegEx\&quot;(one|two|three)\&quot; is: &quot; &lt;&lt; matches[1] &lt;&lt; std::endl;

    std::cin.get();

	return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2257142</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2257142</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Thu, 04 Oct 2012 18:39:15 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe bei regulärem Ausdruck on Thu, 04 Oct 2012 20:55:16 GMT]]></title><description><![CDATA[<p>Danke euch beiden, hab mir grad was gebastelt was mir eine Unmenge an Arbeit gespart hat <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /> Die Beispiele erklärn alles.<br />
Man muss eben nur beachten, dass bei <code>s(\d{2})e(\d{2})</code> die Backslashes doppelt gemacht werden müssen in C++ (sonst sind's unlogische Escape-Sequenzen).</p>
<p>Das fertige Programm sieht dann so aus:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

#include &lt;boost/regex.hpp&gt;

int main()
{
    std::string s = &quot;jsajd/(!1..s05E09T?.!,,d&quot;;
    boost::regex regex(&quot;(\\d{2})e(\\d{2})&quot;, boost::regex_constants::icase); //case-insensitive 
    boost::cmatch matches;
    boost::regex_search(s.c_str(), matches, regex);
    std::cout &lt;&lt; &quot;s = &quot; &lt;&lt; matches[1] &lt;&lt; &quot; e = &quot; &lt;&lt; matches[2];
}
</code></pre>
<p>Ausgabe:</p>
<p>s = 05 e = 09</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2257177</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2257177</guid><dc:creator><![CDATA[Incocnito]]></dc:creator><pubDate>Thu, 04 Oct 2012 20:55:16 GMT</pubDate></item></channel></rss>