Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can i parse/get from a textBox words that are only letters?
    primarykey
    data
    text
    <p>This is the code I have in <code>form1</code> button event:</p> <pre><code>StringBuilder sb = new StringBuilder(); var words = Regex.Split(textBox1.Text, @"(?=(?&lt;=[^\s])\s+)"); foreach (string word in words) { ScrambleTextBoxText scrmbltb = new ScrambleTextBoxText(word.Trim()); scrmbltb.GetText(); sb.Append(word.Replace(word.Trim(), scrmbltb.scrambledWord)); } textBox2.AppendText(sb.ToString()); </code></pre> <p>Im getting all the words as I wanted from <code>textBox1</code> but some of the words are also signs like <code>----</code> or <code>?</code> or <code>/</code> or <code>\n\r</code></p> <p>I want to parse/get only words that are built with letters.</p> <p>How can I filter it?</p> <p>I tried to do it this way:</p> <pre><code>StringBuilder sb = new StringBuilder(); var words = Regex.Split(textBox1.Text, @"(?=(?&lt;=[^\s])\s+\\w+)".Cast&lt;Match&gt;().Select(match =&gt; match.Value)); var matches = Regex.Matches(textBox1.Text, "\\w+").Cast&lt;Match&gt;().Select(match =&gt; match.Value); foreach (string word in words) { ScrambleTextBoxText scrmbltb = new ScrambleTextBoxText(word.Trim()); scrmbltb.GetText(); sb.Append(word.Replace(word.Trim(), scrmbltb.scrambledWord)); } textBox2.AppendText(sb.ToString()); </code></pre> <p>I need the var words since the Regex.Split there worked for me good with copy the spaces between textBox1 and textBox2. So i tried to add the "\w+" and the .Cast().Select(match => match.Value So it will be togeather in the variable words but im getting an error on the var words now:</p> <p>Error 1 The best overloaded method match for 'System.Text.RegularExpressions.Regex.Split(string, int)' has some invalid arguments</p> <p>And</p> <p>Error 2 Argument 2: cannot convert from 'System.Collections.Generic.IEnumerable' to 'int'</p> <p>How can i solve it ?</p> <p>I tried now this but it didnt work:</p> <pre><code>var words = Regex.Matches(textBox1.Text, @"(?=(?&lt;=[^\s])\s+\\w+)").Cast&lt;Match&gt;().Select(match =&gt; match.Value); </code></pre> <p>Im getting no words at all now.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload