Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you were just looking to see if the string contains a <code>_</code>, <code>-</code>, <code>_</code>, <code>-</code> in that order with arbitrary random junk between, we could do that two ways (you can substitute other separators, but a <code>.</code> needs special treatment in a regexp; either <code>[.]</code> or <code>\.</code> will do):</p> <pre><code>regexp {_.+-.+_.+-} $stringToMatchAgainst </code></pre> <pre><code>string match {*_*-*_*-*} $stringToMatchAgainst </code></pre> <p>OK, technically the last one (which is glob matching) matches something slightly different, but the effect is similar.</p> <p>However I'm not sure that the above is what you're really looking for. At a guess you're really after the <code>word</code>s? Possibly also the separators.</p> <p>To get a list of the words, we use a somewhat different technique (can't use <code>\w</code> as that matches underline as well because that's common in identifiers):</p> <pre><code>set wordList [regexp -all -inline {[a-zA-Z0-9]+} $stringToMatchAgainst] </code></pre> <p>If you're after the separators too, the easiest method is to use <a href="http://tcllib.sourceforge.net/doc/textutil_split.html" rel="nofollow"><code>textutil::split::splitx</code></a> from Tcllib:</p> <pre><code>package require textutil::split set tokenList [textutil::split::splitx $stringToMatchAgainst {([-_.])} ] </code></pre> <p>In the last case, with an input string of <code>word_word-word_word_word-word</code> it gives this output:</p> <pre><code>word _ word - word _ word _ word - word </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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