Check out example codes for "checking if a substring exists in a string r". It will help you in understanding the concepts better.

Code Example 1

grepl(regex, string_to_search)

Learn ReactJs, React Native from akashmittal.com