I am making a string parsing problem in PHP. I want a regular expression for a word in a dictionary. The word can only contain AZ and az. I came up with this regex, but that doesn't seem to work. Can someone help.
$regexp = "/[Az]+/"; if(preg_match($regexp,$buffer)){ print $buffer . "<BR>"; }
Adding rkt comment for eadibility
currently using this regex
$regexp = "/[A-Za-z]+/";
but still many irrelevant words are printed, for example.
a.new,#quickbar a.new{color:#ba0000} enwiki:resourceloader:filter:minify-css:5:f2a9127573a22335c2a9102b208c73e7 wgNamespaceNumber=0; wgAction="view"; wgPageName="Roger_Federer"; wgMainPageTitle="ββMain Page"; wgWikimediaMobileUrl="http:\/\/en.m.wikipedia.org\/wiki"; document.writeln("\x3cdiv id=\"localNotice\"\x3e\x3cp\x3e\x3c/p\x3e\n\x3c/div\x3e");
source share