mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* doc/regexp.rdoc: In regexp doc, two backslashes match one literally
In the "Metacharacters and Escapes" section of regexp.rdoc, it said that to match a backslash literally, it must be backslash-escaped, but the rendered HTML showed three backslashes (\\\). There should only be two backslashes (\\). patched by jlmuir (J. Lewis Muir) [fix GH-1677] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									ba9e870709
								
							
						
					
					
						commit
						71b932d675
					
				
					 1 changed files with 2 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -63,9 +63,10 @@ The following are <i>metacharacters</i> <tt>(</tt>, <tt>)</tt>,
 | 
			
		|||
<tt>[</tt>, <tt>]</tt>, <tt>{</tt>, <tt>}</tt>, <tt>.</tt>, <tt>?</tt>,
 | 
			
		||||
<tt>+</tt>, <tt>*</tt>. They have a specific meaning when appearing in a
 | 
			
		||||
pattern. To match them literally they must be backslash-escaped. To match
 | 
			
		||||
a backslash literally backslash-escape that: <tt>\\\\\\</tt>.
 | 
			
		||||
a backslash literally, backslash-escape it: <tt>\\\\</tt>.
 | 
			
		||||
 | 
			
		||||
    /1 \+ 2 = 3\?/.match('Does 1 + 2 = 3?') #=> #<MatchData "1 + 2 = 3?">
 | 
			
		||||
    /a\\\\b/.match('a\\\\b')                    #=> #<MatchData "a\\b">
 | 
			
		||||
 | 
			
		||||
Patterns behave like double-quoted strings so can contain the same
 | 
			
		||||
backslash escapes.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue