<p>What's the easiest way to do an "instring" type function with a regex? For example, how could I reject a whole string because of the presence of a single character such as <code>:</code>? For example: </p>

<ul>
<li><code>this</code> - okay</li>
<li><code>there:is</code> - not okay because of <code>:</code></li>
</ul>

<p>More practically, how can I match the following string: </p>

<pre><code>//foo/bar/baz[1]/ns:foo2/@attr/text()
</code></pre>

<p>For any node test on the xpath that doesn't include a namespace?</p>

<pre><code>(/)?(/)([^:/]+) 
</code></pre>

<p>Will match the node tests but includes the namespace prefix which makes it faulty.</p>

I dont know regex syntax very well but could you not do:
```
[any alpha numeric]\*:[any alphanumeric]\*
```
I think something like that should work no?