I am doing a string parsing problem in PHP. I want a regular expression for a word in a dictionary. The word can contain only A-Z and a-z. I came up with this regex but this seems to be not working. Can someone help.
$regexp = "/[A-z]+/";
if(preg_match($regexp,$buffer)){
print $buffer . "<BR>";
}
Adding rkt’s comment for eadibility
currently using this regex
$regexp = "/[A-Za-z]+/";
but still lot of irrelevant words are getting printed , for eg .
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");
If you want to match a whole word only…