Check out example codes for "php preg replace". It will help you in understanding the concepts better.

Code Example 1

preg_replace($pattern, $replacement, $string);

Code Example 2

preg_replace($pattern, $replacement, $subject [, $limit [, &$count]]);
// Returns an array if the subject parameter is an array,
// or a string otherwise.
// If matches are found, the new subject will be returned, otherwise
// subject will be returned unchanged or NULL if an error occurred.

Learn ReactJs, React Native from