Quote:
I am trying to find the number of periods(.) in a string
You are using RegEx, it happen that some chars have a special meaning in RegEx, and you are lucky because '.' is a special char that match any char.
Regex is a powerful tool, but like with any tool, you need to learn how to use it.
Just a few interesting links to help building and debugging RegEx.
Here is a link to RegEx documentation:
perlre - perldoc.perl.org[
^]
Here is links to tools to help build RegEx and debug them:
.NET Regex Tester - Regex Storm[
^]
Expresso Regular Expression Tool[
^]
This one show you the RegEx as a nice graph which is really helpful to understand what is doing a RegEx:
Debuggex: Online visual regex tester. JavaScript, Python, and PCRE.[
^]