Let us say you have the following string.
var a ="abcdefghidefjkl";
Typically, we use the following regular expression to match string containing substring def. The following command returns first occurrence.
substr = string.match(/def/);
We use the following expression to get all occurrences.
substr = string.match(/def/g);
But both the above expressions will also match strings that contain extra characters before and after the target expression.
If you only want exact match of target string you need to add ^ and $ before and after the target string respectively.
substr = string.match(/^def$/g);
In the above regular expression, ^ character means starting with and $ sign indicates ending with. So basically, the above regular expression means starting & ending with def, that is, exact match of def string.
How to Convert Columns to Rows in Pandas
How to Set/Unset Cookie with jQuery