You need to use region or regionline.
regionline will return you an array of strings which you can then iterate over and conditionally search for what you need.

Regards,