Ruby

37
1217 reads

February 28, 2013

Debugging


The default Ruby debugger allows you to set breakpoints and watchpoints and evaluate variables while your programs execute.

38
1238 reads

February 28, 2013

String Operator


The split method splits a string into substrings, based on a pattern. The results (minus the pattern) are returned as an array; an empty pattern splits a string into characters

39
1255 reads

February 28, 2013

Matching Data Complex Pattern


Matching from the start or end of a string becomes more useful when it forms a part of a more complex pattern. Often such a pattern tries to match zero or more instances of a specified pattern.

38
1338 reads

February 28, 2013

Match a String


Frequently, it is useful to attempt to match some expression from the very start of a string; the character ^ followed by a match term is used to specify this.

32
1327 reads

February 28, 2013

Specific Data Only


Using Symbols of Specific Type only

21
1268 reads

February 28, 2013

Making Matches Regex2


You could use these techniques to determine specific characteristics of strings, such as whether or not a given string is uppercase, lowercase or mixed case

37
1342 reads

February 28, 2013

Making Matches Regex1


While we’ve used forward slash delimiters in the Making Matches, there are alter-native ways of defining regular expressions: you can specifically create a new Regexp object initialized with a string

24
1373 reads

February 28, 2013

Making Matches


Just about the simplest regular expression would be a sequence of characters, such as ‘abc’, which you want to find in a string.

34
1409 reads

February 28, 2013

Pre Match and Post Match


The MatchData class supplies the pre_match and post_match methods to return the strings preceding or following a match. Here, for example, we make a match on the comment character

27
1371 reads

February 28, 2013

Regular Expression Overview


This is a list of some of the elements which can be used in regular expressions...
^ beginning of a line or string
$ end of a line or string
. any character except newline