reg :regular expression

You'll have to make the regexp multline with the /m option (i.e. /foo/ m) or it won't match across newlines.

Rein

Hi Shivan, I tried with this regex, it worked for both the example you mentioned.

reg = /^[a-zA-Z]+\.[a-zA-Z]+[a-zA-Z ]+[\s]*$/

str = two example values you specified.

str =~ reg -----> 0(output)