JSFiddle - React, Tailwind, and code Playground

JavaScript

var value = 'Lvl 1 TowerB, 999 C G Road';

function isPOBox(v){
        var r = new RegExp('[PDO.]*\\s?B(ox)?.*\\d+', 'i');
        return v.match(r);
    }


if(isPOBox(value)){
    alert('POBox detected');
}else{
    alert('POBox free');
}