 
      
      regex_search()Perform a regular expression search
regex_search(pattern, subject, case_sensitive = false)
pattern (string)  — Regex pattern to search for. The pattern follows the ECMAScript syntaxsubject (string)  — The target sequencecase_sensitive (boolean, optional)  — If case_sensitive is true then regex is performed with regard to case. The default value is false
regex[] — Returns array of regex object that contains regex search result
import regex
 
a = regex_search("(\w+)@(\w+)\.com", "clara@gmail.com; sarah@gmail.com")
b = a[0].value            ' b = "clara@gmail.com"
c = a[1].group[0].value   ' c = "sarah"
 
' a is:
' array(
'     [0] = regex(
'         .group = array(
'             [0] = regex_group(
'                 .position = 0
'                 .value = "clara"
'             )
'             [1] = regex_group(
'                 .position = 6
'                 .value = "gmail"
'             )
'         )
'         .position = 0
'         .value = "clara@gmail.com"
'     )
'     [1] = regex(
'         .group = array(
'             [0] = regex_group(
'                 .position = 17
'                 .value = "sarah"
'             )
'             [1] = regex_group(
'                 .position = 23
'                 .value = "gmail"
'             )
'         )
'         .position = 17
'         .value = "sarah@gmail.com"
'     )
' )