# StringScanner::search\_full documentation error -?

**URL:** <https://www.ruby-forum.com/t/stringscanner-search-full-documentation-error/156704>\
**Category:** Ruby\
**Created:** [January 1, 2009, 2:59pm UTC](https://www.ruby-forum.com/t/stringscanner-search-full-documentation-error/156704 "2009-01-01T14:59:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbcox23](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tbcox23](https://www.ruby-forum.com/u/tbcox23)\
**Post date:** [January 1, 2009, 2:59pm UTC](https://www.ruby-forum.com/t/stringscanner-search-full-documentation-error/156704/1 "2009-01-01T14:59:46Z")

</div>

Meager as my Ruby skills are, I hesitate to claim to have found a documentation error, but I'm not sure what else to call it. I've looked for a ruby documentation list to report this to, and haven't found one, so I send it here.  
  
At [http://ruby-doc.org/core/](http://ruby-doc.org/core/), documentation for StringScanner::search\_full reads -

"[search\_full(pattern, return\_string\_p, advance\_pointer\_p)  
  ](http://ruby-doc.org/core/classes/StringScanner.src/M002050.html) 

Scans the [string](http://ruby-doc.org/core/classes/StringScanner.html#M002033)_until_ the pattern is [matched](http://ruby-doc.org/core/classes/StringScanner.html#M002062). Returns the [matched](http://ruby-doc.org/core/classes/StringScanner.html#M002062)[string](http://ruby-doc.org/core/classes/StringScanner.html#M002033) if return\_string\_p is true, otherwise returns the number of bytes advanced. Advances the [scan](http://ruby-doc.org/core/classes/StringScanner.html#M002041)[pointer](http://ruby-doc.org/core/classes/StringScanner.html#M002039) if advance\_pointer\_p, otherwise not. This method does affect the match register."

But consider these (edited) results...

irb(main):005:0\> a='abc .r def .n'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   
=\> "abc .r def .n"&nbsp;   
irb(main):009:0\> aa=StringScanner.new(a)  
=\> #\<StringScanner 0/13 @ "abc ...."\>   
irb(main):014:0\> aa.search\_full(/\.r /,true,false)  
=\> 7  
irb(main):016:0\> aa.pos  
=\> 7

[comment: these results are the opposite of what I expected - I did NOT get back the matched string, and the pointer WAS advanced.]

irb(main):021:0\> aa.reset  
=\> #\<StringScanner 0/13 @ "abc ...."\>  
irb(main):022:0\> aa.search\_full(/\.r /,false,true)  
=\> "abc .r "  
irb(main):023:0\> aa.pos  
=\> 0

[comment: again - this is the opposite of what I expected, given the documentation.]

irb(main):025:0\> a  
=\> "abc .r def .n"

Environment:  
OS: Kubuntu Linux 8.10 Intrepid Ibix  
/$ ruby -v  
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]

I've stared at these results for some minutes and don't yet see an "pilot error".  
  
All comments welcome.  
  
Tom  

```
--

```auto
Tom C., MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
&lt;&lt; <a class="moz-txt-link-abbreviated" 
href="mailto:removed_email_address@domain.invalid">removed_email_address@domain.invalid</a> &gt;&gt; (email)
&lt;&lt; TomCloyd.com &gt;&gt; (website)
&lt;&lt; sleightmind.wordpress.com &gt;&gt; (mental health weblog)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ </pre>
</body>
</html>
```
```
