Check out example codes for "swift check if regex is in string". It will help you in understanding the concepts better.

Code Example 1

if string.range(of: regex, options: .regularExpression, range: nil, locale: nil) != nil ...

Learn ReactJs, React Native from akashmittal.com