A
Al Cholic
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.
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.