Q:

use preg_match to grab value

this is what I have so far: 
$data = "Hello this is on1";
if (preg_match("/n/", $data)){
  $status = "it contains n";
}
if (preg_match("/n1/", $data)){
  $status1 = "it contains n1";
}
echo $status;
echo $status1;

this will say that $data it contains "n" then that $data contains "n1"
the issue I am having is how do I grab "n" alone. 
it should return "it contains n" only if $data="Hello this contains n";
in other terms the letter "n" should not be attached to ANY number, if it's attached to something else that's fine.

A:

Use word boundaries \b and negative lookahead like this:
if (preg_match("/\b(n(?!\d+)[^\b]*)/", $data)){
  $status = "it contains n";
}

\b will make sure n is matched with word boundaries hence on1 will not be matched.

