PROPERTY:
RegExp::lastMatch
RegExp.lastMatch
This property is the last matched characters. As this property is
static, you always use RegExp.lastMatch. For example, the following
code would search through the string "the fisherman's tale" for a match
with the regular expression of two consonants, one or more vowels and
two consonants. In this case it will match the 'sherm' of 'fisherman'.
Code:
rexp = /([^aeiou\s]){2}([aeiou])+([^aeiou\s]){2}/
rexp("the fisherman's tale")
Output:
sherm
|