From: Al Cholic Date: 2007-07-06T14:18:15+09:00 Subject: Regex: What does the ^ do? What is it called? Hello, Im trying to understand what the ^ and $ characters do when used in regular expressions. For example: /^abc/ =~ "!abc" returns nil "You can use an anchor to match the beginning of a string" /abc$/ =~ "abc!" returns nil "You can use an anchor to match the end of a string" Why do these two statements return nil and how does the "anchor" work exactly? Can someone please clarify? Does this mean that the regex is checking before the C\d+ ? if @refdes[0] =~ /^C\d+/ return "Capacitor" Thanks in advance. -- Posted via http://www.ruby-forum.com/.